home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / CSMP Digest / volume 3 / csmp-digest-v3-090 < prev    next >
Text File  |  1995-12-31  |  96KB  |  2,590 lines

  1. C.S.M.P. Digest             Fri, 24 Mar 95       Volume 3 : Issue 90
  2.  
  3. Today's Topics:
  4.  
  5.         CW5, ansi C, and 68k vs. PPC vs. SG
  6.         Copybits trouble.
  7.         NEWBIE: Saving Popup Menu Selection
  8.         Recommend: A better List Mgr.
  9.         Resources and header files
  10.         Temporary Memory question...
  11.         The State of MPW
  12.         [Q] FSSpec --> dirID
  13.  
  14.  
  15.  
  16. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  17. (pottier@clipper.ens.fr).
  18.  
  19. The digest is a collection of article threads from the internet newsgroup
  20. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  21. regularly and want an archive of the discussions.  If you don't know what a
  22. newsgroup is, you probably don't have access to it.  Ask your systems
  23. administrator(s) for details.  If you don't have access to news, you may
  24. still be able to post messages to the group by using a mail server like
  25. anon.penet.fi (mail help@anon.penet.fi for more information).
  26.  
  27. Each issue of the digest contains one or more sets of articles (called
  28. threads), with each set corresponding to a 'discussion' of a particular
  29. subject.  The articles are not edited; all articles included in this digest
  30. are in their original posted form (as received by our news server at
  31. nef.ens.fr).  Article threads are not added to the digest until the last
  32. article added to the thread is at least two weeks old (this is to ensure that
  33. the thread is dead before adding it to the digest).  Article threads that
  34. consist of only one message are generally not included in the digest.
  35.  
  36. The digest is officially distributed by two means, by email and ftp.
  37.  
  38. If you want to receive the digest by mail, send email to listserv@ens.fr
  39. with no subject and one of the following commands as body:
  40.     help                                Sends you a summary of commands
  41.     subscribe csmp-digest Your Name     Adds you to the mailing list
  42.     signoff csmp-digest                 Removes you from the list
  43. Once you have subscribed, you will automatically receive each new
  44. issue as it is created.
  45.  
  46. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  47. Questions related to the ftp site should be directed to
  48. scott.silver@dartmouth.edu.
  49.  
  50. -------------------------------------------------------
  51.  
  52. >From pfiglioz@indiana.edu (Peter Figliozzi)
  53. Subject: CW5, ansi C, and 68k vs. PPC vs. SG
  54. Date: Sun, 26 Feb 1995 17:19:29 -0500
  55. Organization: Indiana U. Dept. of Physics
  56.  
  57.  
  58. This weekend I whipped up a little program that just does a big
  59. computation; it's ANSI C.  I compiled it with CW5 for my PPC 6100/60, for
  60. 68k (ran on the same PPC under emulation), and then popped in on the
  61. Silicon Graphics Indigo I use at work.
  62.  
  63. Here are the results:
  64.  
  65. PPC w/ 68k emulation          240 sec.
  66. PPC 6100/60 native             40 sec.
  67. Indigo                          6 sec.
  68.  
  69.  
  70. First, I am very impressed with CW5 because I didn't have to edit one
  71. stinkin' line of code to get it to run on the Indigo!  Even the compiler
  72. warnings were the same!!
  73.  
  74. My question is (and it might be a little nitpicky): I'm supposed to be
  75. about 10x faster with floating point stuff with native PPC than 68k,
  76. right??  As you can see I only get about 6x speedup.
  77.  
  78. I must be doing something with the compiler options or inefficient code. 
  79. Playing with the compiler options, adding register variables, and making
  80. functions inline produced no noticeable effect.  Maybe someone can give me
  81. some comments?  I tacked the code onto the end of this message.  Here's
  82. what it does:
  83.  
  84. [We've got 125 atoms in a lattice and we add up their potential
  85. energies.   That's a lot of computations, since the energy must be
  86. computed for each pair of atoms.. that's "125 choose 2" or 15,500
  87. interactions.  This big calculation is repeated for 100 different
  88. interaction strengths.  (Side note: don't worry about the fact that the
  89. WrapDistance routine has three parameters that aren't used yet.  They will
  90. be soon! )  ]
  91.  
  92. Thanks!!
  93.  
  94.  
  95. /* 
  96.  
  97. Calculates the energy of a particles in a cubic lattice at T=0 (potential
  98. energy only).
  99. Particles obey a 1/r^12 - 1/r^6 potential.
  100.  
  101. The computation is performed for different densities.
  102.  
  103.  
  104. */
  105.  
  106. ////////////////////////////////////////////////////////////////////////////////////////////
  107. // globals
  108. ////////////////////////////////////////////////////////////////////////////////////////////
  109.  
  110. #include <stdio.h>
  111. #include <math.h>
  112.  
  113. typedef struct
  114. {
  115.    int x;
  116.    int y;        // holds coordinates of a particle
  117.    int z;
  118.  
  119. } tuple;
  120.  
  121. // size of the lattice :
  122.  
  123. #define  L_x   5
  124. #define  L_y   5
  125. #define  L_z   5
  126.  
  127. #define     num_particles  L_x * L_y * L_z
  128.  
  129.  
  130. float Potential(float sigma_over_r);
  131. float WrapDistance( tuple *particle1, tuple *particle2, 
  132.                      int x_length, int y_length, int z_length);
  133. float FindEnergy(float sigma /* range of potential */);
  134. void  BuildParticleTable(void);
  135.  
  136.  
  137. tuple particle[ num_particles + 1];  // +1 so we can count from 1 instead
  138. of zero
  139.  
  140.  
  141.  
  142. ////////////////////////////////////////////////////////////////////////////////////////////
  143. ////////////////////////////////////////////////////////////////////////////////////////////
  144.  
  145. void main(void)
  146. {
  147. float energy;
  148. float sigma;
  149.  
  150. int n;
  151.  
  152.     printf("\n");
  153.     
  154.     BuildParticleTable();
  155.     
  156.     for (n=0; n<100; n++)
  157.     {
  158.       sigma = 0.01 + n*.05;
  159.       energy = FindEnergy(sigma);
  160.    
  161.       printf("Sigma: %4.2f   Energy: %6.2f \n",sigma,energy);
  162.    };
  163.    
  164. }
  165.  
  166. ////////////////////////////////////////////////////////////////////////////////////////////
  167.  
  168. void BuildParticleTable(void)
  169. {
  170.  
  171.  
  172. int i,j,k,n;
  173.  
  174. //
  175. // first build a lookup table of particles, called "particle"
  176. //
  177.  
  178. n=1;
  179.  
  180.    for (i=1; i <= L_x; i++)
  181.    {
  182.       for (j=1; j <= L_y; j++)
  183.       {
  184.          for (k=1; k<= L_z; k++)  
  185.                 
  186.          {
  187.             particle[n].x = i;
  188.             particle[n].y = j;
  189.             particle[n].z = k;
  190.                
  191.             n++;
  192.          };
  193.       };
  194.    
  195.    };    
  196.  
  197. }
  198.  
  199. ////////////////////////////////////////////////////////////////////////////////////////////
  200.  
  201. float FindEnergy(float sigma /* range of potential */)
  202. {
  203.  
  204.  
  205. int n,m; // for looping
  206.  
  207. float distance;
  208. float scaled_inv_distance;
  209. float energy = 0;
  210.  
  211.             
  212. // now add up pair interactions, using the particle lookup table
  213. // to avoid overcounting
  214.    
  215.    for (n=1; n < num_particles; n++)
  216.    {
  217.       for (m=n+1; m <= num_particles; m++)
  218.       {        
  219.             
  220.             
  221.             distance = WrapDistance ( &(particle[n]),
  222.                                       &(particle[m]),
  223.                                            0,0,0);
  224.             
  225.             scaled_inv_distance = sigma * (1/distance); 
  226.                
  227.             energy += Potential(scaled_inv_distance);
  228.       }
  229.    }
  230.  
  231.    return energy;
  232. }
  233.  
  234. ////////////////////////////////////////////////////////////////////////////////////////////
  235.  
  236. float Potential(float sigma_over_r)
  237. {
  238. #define  epsilon  1  // scale factor
  239.  
  240. float to_the_sixth;
  241.  
  242.    // to speed things up a bit, DON'T CALL pow(x,y) for x^y.
  243.    // Multiplication is MUCH faster
  244.  
  245.    to_the_sixth =
  246. sigma_over_r*sigma_over_r*sigma_over_r*sigma_over_r*sigma_over_r*sigma_over_r;
  247.    
  248.    return 4*epsilon*( to_the_sixth*to_the_sixth - to_the_sixth );
  249.    
  250. }
  251.  
  252. ////////////////////////////////////////////////////////////////////////////////////////////
  253.  
  254. // WrapDistance
  255. //
  256. // calculates the reduced r known as [r_ij] ("video game boundary conditions")
  257. // edge effects are reduced (hopefully)
  258. //
  259. // particle coordinates are (i1,j1,k1)  (i2,j2,k2)
  260. //
  261.  
  262.  
  263. float WrapDistance( tuple *particle1, tuple *particle2, 
  264.                      int x_length, int y_length, int z_length)
  265. {
  266. float dist_sqr;
  267.  
  268. float dx, dy, dz;
  269.  
  270.     dx = particle1->x - particle2->x;
  271.     dy = particle1->y - particle2->y;
  272.     dz = particle1->z - particle2->z;
  273.     
  274.    dist_sqr = dx*dx + dy*dy +dz*dz;
  275.    
  276.    return pow(dist_sqr,0.5);  
  277. }
  278. -- 
  279.  
  280. // Pete Figliozzi
  281. // pfiglioz@indiana.edu
  282. // phone: (+1) 812 855 5422
  283. // fax:   (+1) 812 855 0440
  284.  
  285. +++++++++++++++++++++++++++
  286.  
  287. >From megawatt@noproblem.uchicago.edu (MegaWatt)
  288. Date: Mon, 27 Feb 1995 16:42:36 GMT
  289. Organization: University of Chicago
  290.  
  291. In article <pfiglioz-2602951719290001@xyplex4-1-3.ucs.indiana.edu>,
  292. pfiglioz@indiana.edu (Peter Figliozzi) wrote:
  293.  
  294. >This weekend I whipped up a little program that just does a big
  295. >computation; it's ANSI C.  I compiled it with CW5 for my PPC 6100/60, for
  296. >68k (ran on the same PPC under emulation), and then popped in on the
  297. >Silicon Graphics Indigo I use at work.
  298. >
  299. >Here are the results:
  300. >
  301. >PPC w/ 68k emulation          240 sec.
  302. >PPC 6100/60 native             40 sec.
  303. >Indigo                          6 sec.
  304.  
  305. [ rest deleted ]
  306.  
  307.  
  308. Try changing all of your int variables to float. Merely using floats
  309. instead of ints whenever you can will increase execution speed. (this is
  310. especially useful for loop control variables)
  311.  
  312. - --------------------------------------------------------------------
  313.   MegaWatt                         |
  314.                                    |    _____  _____  _____   _   _ 
  315.   - AKA -                          |   |__  / | ___ || ___ \ | | | |
  316.                                    |     / /  | |_| || |_/ / | | | |
  317.   Aaron L. Bratcher                |    / /__ | ___ ||  __/  |_| |_|
  318.   University of Chicago            |   |_____||_| |_||_|     (_) (_)
  319.   megawatt@noproblem.uchicago.edu  |
  320. - --------------------------------------------------------------------
  321.  
  322. "I think it's a good thing Bill Gates is getting married, because then
  323. he may find out there's more to life than working on computers!!"
  324. -- Richard Finkelstein, President, Chicago based Performance Computing
  325.  
  326. +++++++++++++++++++++++++++
  327.  
  328. >From tanderse@uoguelph.ca (Tom Andersen)
  329. Date: 27 Feb 1995 17:06:09 GMT
  330. Organization: University of Guelph
  331.  
  332. Peter, You are missing the new faster Mathlib.
  333.  
  334. It is on the Code warrior disks.
  335.  
  336. Install it and your timing will be as follows:
  337. >This weekend I whipped up a little program that just does a big
  338. >computation; it's ANSI C.  I compiled it with CW5 for my PPC 6100/60, for
  339. >68k (ran on the same PPC under emulation), and then popped in on the
  340. >Silicon Graphics Indigo I use at work.
  341.  
  342. >Here are the results:
  343.  
  344. >PPC w/ 68k emulation          240 sec.
  345. >PPC 6100/60 native             40 sec.
  346. >Indigo                          6 sec.
  347. PowerMac with New mathlib       6.13 sec
  348. With one change to source:      4.05 sec
  349. with some samll changes plus 
  350. turn optimizer on full          2.65 secs
  351.  
  352. Tom Andersen
  353.  
  354. +++++++++++++++++++++++++++
  355.  
  356. >From gewekean@student.msu.edu (Andrew Geweke)
  357. Date: Mon, 27 Feb 1995 12:20:58 -0600
  358. Organization: Michigan State University
  359.  
  360. In article <megawatt-2702951042360001@fpm-mac-17.uchicago.edu>, 
  361. megawatt@noproblem.uchicago.edu (MegaWatt) writes:
  362. > Try changing all of your int variables to float. Merely using 
  363. > floats instead of ints whenever you can will increase execution 
  364. > speed. (this is especially useful for loop control variables) 
  365.  
  366. Bzzzt. Wrong answer. This _sometimes_ works; however, if his computations are 
  367. all done using FP, he'll often be better off using ints as loop control 
  368. variables.
  369.  
  370. The reason people say what you said is because quite often loops are doing 
  371. _only_ integer computations. The 601, 603, 604, and 620 all have at least one 
  372. FP pipe and one integer pipe. So, if your loop is doing integer calcs and your 
  373. loop control variable is integer, you're not getting any use out of the FP 
  374. pipe. If you make your control variable a FP variable, it'll use that extra 
  375. pipe and will run "in parallel" to some degree. It'll speed things up.
  376.  
  377. But if all his calcs (or at least some of them) are done in FP inside the 
  378. loop, it'll slow things down, instead. He'll be better off using an integer 
  379. loop counter.
  380.  
  381.                                                         / ag
  382.  
  383.  
  384. - -------------------------------------------------------------------------
  385. Andrew Geweke / Michigan State / http://www.cps.msu.edu/~gewekean/home.html
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. +++++++++++++++++++++++++++
  395.  
  396. >From willie-abrams@uokhsc.edu (Willie Abrams)
  397. Date: Mon, 27 Feb 1995 09:59:00 -0600
  398. Organization: OUHSC Telemedicine
  399.  
  400. In article <pfiglioz-2602951719290001@xyplex4-1-3.ucs.indiana.edu>,
  401. pfiglioz@indiana.edu (Peter Figliozzi) wrote:
  402.  
  403. > This weekend I whipped up a little program that just does a big
  404. > computation; it's ANSI C.  I compiled it with CW5 for my PPC 6100/60, for
  405. > 68k (ran on the same PPC under emulation), and then popped in on the
  406. > Silicon Graphics Indigo I use at work.
  407. > Here are the results:
  408. > PPC w/ 68k emulation          240 sec.
  409. > PPC 6100/60 native             40 sec.
  410. > Indigo                          6 sec.
  411.  
  412. Ugh. I was a bit frightened by your results - the PowerMac should have
  413. been as fast (if not faster than the stinkin' SGI) - so I went back and
  414. started though your code and popped it into my copy of CW5.
  415.  
  416. First, anytime SIOUX (the ANSI console in MW) gets mixed in, you are
  417. preparing yourself for a slowdown. Any kind of standard I/O is going to
  418. have to grope things into the right format - either lump all of the
  419. printfs together into blocks, write your own I/O routines, or write the
  420. results after the calculations are done.
  421.  
  422. Next, get a hold of the Balance of Power articles by Dave Evans from
  423. develop - they have some nice techniques for writing code that uses the
  424. RISC architecture to its advantage. (It might speed up your Indigo
  425. execution times as well.) Unrolling some of your loops could increase your
  426. preformance - I didn't have time to rewrite the code...
  427.  
  428. Third, use one of the new versions of the Apple MathLib. This will flat
  429. out explode your performance. Look on your CW5 CD for details - I used the
  430. MathLib v2 to get the best performance out of your code. I compared the
  431. output (BBEdit of course), and there was no numerical difference in the
  432. output values.
  433.  
  434. (Note: 60 ticks to a second...)
  435.  
  436. PowerMac 8100/80
  437.  
  438. Printf, No Opt, Rom MathLib, Time Elapsed (in Ticks): 1866 (~31 sec.)
  439. No Printf, No Opt, Rom MathLib,Time Elapsed (in Ticks): 1429 (~24 sec.)
  440. No Printf, Full Opt, Rom MathLib, Time Elapsed (in Ticks): 1398 (~23 sec.)
  441.  
  442. Printf, Full Opt, MathLib v2, Time Elapsed (in Ticks): 634 (~11 sec.)
  443. No Printf, No Opt, MathLib v2,Time Elapsed (in Ticks): 262 (~4.3 sec.)
  444. No Printf, Full Opt, MathLib v2,Time Elapsed (in Ticks): 238 (~4 sec.)
  445.  
  446. As Keith Olbermann would say, "BANG!"
  447.  
  448. Now, how much does an Indigo cost? :-)
  449.  
  450. > // Pete Figliozzi
  451. > // pfiglioz@indiana.edu
  452. > // phone: (+1) 812 855 5422
  453. > // fax:   (+1) 812 855 0440
  454.  
  455. W.
  456.  
  457. --
  458. Willie Abrams, willie-abrams@uokhsc.edu
  459.  
  460. "...I'm tired and have little patience for ROM-headed Unix weenies right now..."
  461. -Chuck Shotton
  462.  
  463. +++++++++++++++++++++++++++
  464.  
  465. >From plumpto@bnr.ca (David Plumpton)
  466. Date: Tue, 28 Feb 1995 09:05:16 +1100
  467. Organization: BNR Australia
  468.  
  469. Why does the new math library make such a large difference? As far as I can
  470. tell from the source, the only floating point library call is for the pow()
  471. to do that square root. Everything else is just +, -, *, and /.
  472. Is there really that much time consumed by the one routine?
  473.  
  474. -- 
  475. David Plumpton              Nobody wants my opinions
  476. plumpto@bnr.ca
  477.  
  478. +++++++++++++++++++++++++++
  479.  
  480. >From fdj@muc.de (Florian -FDj- Dejako)
  481. Date: Tue, 28 Feb 1995 01:31:31 +0100
  482. Organization: None. None at all!
  483.  
  484. In article <3it0q1$96r@ccshst05.cs.uoguelph.ca>, tanderse@uoguelph.ca (Tom
  485. Andersen) wrote:
  486.  
  487. > Peter, You are missing the new faster Mathlib.
  488. > It is on the Code warrior disks.
  489. > Install it and your timing will be as follows:
  490.  
  491. > >Here are the results:
  492. > >PPC w/ 68k emulation          240 sec.
  493. > >PPC 6100/60 native             40 sec.
  494. > >Indigo                          6 sec.
  495. > PowerMac with New mathlib       6.13 sec
  496. > With one change to source:      4.05 sec
  497. > with some samll changes plus 
  498. > turn optimizer on full          2.65 secs
  499. > Tom Andersen
  500.  
  501. Amazing!
  502.  
  503. FDj
  504.  
  505. -- 
  506. ____________________________________________________________________
  507. Florian Dejako                           Student of Computer Science
  508. fdj@muc.de                                  and Macintosh Fanatic
  509.  
  510. +++++++++++++++++++++++++++
  511.  
  512. >From tanderse@uoguelph.ca (Tom Andersen)
  513. Date: 28 Feb 1995 21:54:39 GMT
  514. Organization: University of Guelph
  515.  
  516. David Plumpton (plumpto@bnr.ca) wrote:
  517. : Why does the new math library make such a large difference? As far as I can
  518. : tell from the source, the only floating point library call is for the pow()
  519. : to do that square root. Everything else is just +, -, *, and /.
  520. : Is there really that much time consumed by the one routine?
  521.  
  522. : -- 
  523. : David Plumpton              Nobody wants my opinions
  524. : plumpto@bnr.ca
  525.  
  526. David,
  527.  
  528. The old ROM version of Mathlib typically does 20k floating pints per 
  529. second (sin, exp, sqrt, etc).
  530.  
  531. The new one is TWENTY TIMES faster!!
  532.  
  533. So yes in the original post >95% of the time was spent in the one call to
  534. pow(x, 0.5) !
  535.  
  536. even with the fast mathlib it still well over 50%.
  537.  
  538. Tom Andersen
  539.  
  540. +++++++++++++++++++++++++++
  541.  
  542. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  543. Date: Thu, 2 Mar 1995 11:17:59 +1300 (NZDT)
  544. Organization: (none)
  545.  
  546. pfiglioz@indiana.edu (Peter Figliozzi) writes:
  547. > This weekend I whipped up a little program that just does a big
  548. > computation; it's ANSI C.  I compiled it with CW5 for my PPC 6100/60, for
  549. > 68k (ran on the same PPC under emulation), and then popped in on the
  550. > Silicon Graphics Indigo I use at work.
  551. > Here are the results:
  552. > PPC w/ 68k emulation          240 sec.
  553. > PPC 6100/60 native             40 sec.
  554. > Indigo                          6 sec.
  555.  
  556. Changing the line...
  557.  
  558.    return pow(dist_sqr,0.5);
  559.  
  560. ... to ...
  561.  
  562.    return sqrt(dist_sqr);
  563.  
  564. ... cut it down from 35 seconds to 9 seconds on my 6100/60.
  565.  
  566. -- Bruce
  567.  
  568. +++++++++++++++++++++++++++
  569.  
  570. >From bss2p@kelvin.seas.Virginia.EDU (Brent S. Stone)
  571. Date: Sat, 4 Mar 1995 04:53:03 GMT
  572. Organization: University of Virginia
  573.  
  574. In article <plumpto-2802950905160001@47.181.192.81>,
  575. David Plumpton <plumpto@bnr.ca> wrote:
  576. >Why does the new math library make such a large difference? As far as I can
  577. >tell from the source, the only floating point library call is for the pow()
  578. >to do that square root. Everything else is just +, -, *, and /.
  579. >Is there really that much time consumed by the one routine?
  580. >
  581. little side info- 
  582. I timed 50 million iterations of the pow and sqrt functions
  583. and got:   
  584. pow  433 sec
  585. sqrt 116 sec
  586.  
  587. pow is pitiful for any simple exponents. 
  588. To get a^3.5  you're better off doing a*a*sqrt(a)
  589.  
  590. fmod was the worst function I looked at by far.
  591. acos, asin, pow are in the same ballpark execution timewise.
  592.  
  593. I would have thought the ppc would have had instructions for
  594. floor, ceil and round but its not the case.  
  595.  
  596.  
  597.  
  598. +++++++++++++++++++++++++++
  599.  
  600. >From Andreas Franz <root@flugor.si.sub.de>
  601. Date: Sun, 05 Mar 95 22:46:19 +0100 (MEZ)
  602. Organization: (none)
  603.  
  604.  
  605. In article <pfiglioz-2602951719290001@xyplex4-1-3.ucs.indiana.edu>, Peter 
  606. Figliozzi writes:
  607.  
  608. > This weekend I whipped up a little program that just does a big
  609. > computation; it's ANSI C.  I compiled it with CW5 for my PPC 6100/60, 
  610. for
  611. > 68k (ran on the same PPC under emulation), and then popped in on the
  612. > Silicon Graphics Indigo I use at work.
  613. > Here are the results:
  614. > PPC w/ 68k emulation          240 sec.
  615. > PPC 6100/60 native             40 sec.
  616. > Indigo                          6 sec.
  617. > First, I am very impressed with CW5 because I didn't have to edit one
  618. > stinkin' line of code to get it to run on the Indigo!  Even the compiler
  619. > warnings were the same!!
  620. > My question is (and it might be a little nitpicky): I'm supposed to be
  621. > about 10x faster with floating point stuff with native PPC than 68k,
  622. > right??  As you can see I only get about 6x speedup.
  623. > I must be doing something with the compiler options or inefficient code. 
  624.  
  625. > Playing with the compiler options, adding register variables, and making
  626. > functions inline produced no noticeable effect.  Maybe someone can give 
  627. me
  628. > some comments?  I tacked the code onto the end of this message.  Here's
  629. > what it does:
  630. You did right. I got 34 seconds on my 7100/66
  631.  
  632. The problem is the function "pow". It's done by software and slowwwwww.
  633. The fpu found in the ppc 601 is very fast. But it has no sin, tan, pow, 
  634. sqrt, .......... All those functions are done by the mathlib, found in rom 
  635. or, as a faster version, in your extensions-folder.
  636.  
  637. hope this helps
  638. Andreas
  639. --
  640. What do you get when you cross a parrot with a centipede?
  641. You'll get a walkie-talkie ;-)))
  642.   The best way to accelerate a PC is 9.8 m/s^2
  643.  
  644. ---------------------------
  645.  
  646. >From ernie@winternet.com (Ernie Soffronoff)
  647. Subject: Copybits trouble.
  648. Date: 3 Mar 1995 15:50:02 GMT
  649. Organization: StarNet Communications, Inc
  650.  
  651. Howdy,
  652.  
  653. In an effort to be cool, I decided to try some off-screen graphics a la 
  654. NIM: Imaging with Quickdraw.  The result: I'm not cool.  I get a type 
  655. mismatch on the copybits line of the code below.  The rest of it seems 
  656. okay, allocating memory and such and not crashing.  What the heck is 
  657. copybits expecting?  (And why the heck is NIM in Pascal?)
  658.  
  659. (And if you feel like commenting on anything else, go ahead.)
  660.  
  661. (I took out some error checking to make the code shorter.)
  662.  
  663. --Ernie
  664.  
  665. static void DoDrawQuick(void)
  666. {
  667.  
  668.         CGrafPtr                origPort;
  669.         GDHandle                origDev;
  670.         QDErr                   myErr;
  671.         GWorldPtr               myOffGWorld;
  672.         PixMapHandle            offPixMapHandle;
  673.         short                   good;
  674.         Rect                    sourceRect, destRect;
  675.         GWorldFlags             flags = nil;
  676.         
  677.         PixMapHandle    pmh;
  678.  
  679.         GetGWorld(&origPort,&origDev);
  680.         myErr = NewGWorld(&myOffGWorld, 0, &(curWindow->portRect), nil, nil, 0);
  681.         SetGWorld(myOffGWorld, nil);
  682.         offPixMapHandle = GetGWorldPixMap(myOffGWorld);
  683.         good = LockPixels(offPixMapHandle);
  684.         EraseRect(&(myOffGWorld->portRect));
  685.  
  686.         //Do some drawing here  
  687.  
  688.         SetGWorld(origPort, origDev);
  689.         sourceRect = myOffGWorld->portRect;
  690.         sourceRect.bottom = myOffGWorld->portRect.bottom - 15;
  691.         sourceRect.right = myOffGWorld->portRect.right - 15;
  692.         destRect = curWindow->portRect; 
  693.         destRect.bottom = curWindow->portRect.bottom - 15;
  694.         destRect.right = curWindow->portRect.right - 15;
  695.  
  696.         pmh = myOffGWorld->portPixMap;
  697.         
  698.         CopyBits(*pmh, GrafPtr(curWindow)->portBits, sourceRect, 
  699.                         destRect, srcCopy, nil);
  700.  
  701.         UnlockPixels(offPixMapHandle);
  702.         DisposeGWorld(myOffGWorld);
  703. }
  704.  
  705.  
  706. +++++++++++++++++++++++++++
  707.  
  708. >From learntv@aol.com (LearnTV)
  709. Date: 3 Mar 1995 11:43:21 -0500
  710. Organization: America Online, Inc. (1-800-827-6364)
  711.  
  712. > pmh = myOffGWorld->portPixMap;
  713. > CopyBits(*pmh, GrafPtr(curWindow)->portBits, sourceRect, 
  714. >   destRect, srcCopy, nil);
  715.  
  716. Your problem with this statement is how you are casting
  717. curWindow.  The above is Pascal syntax.  It should be:
  718.  
  719. pmh = GetGWorldPixMap(myOffGWorld);
  720.  
  721. CopyBits((BitMap *) (*pmh), 
  722.    &curWindow->portBits,
  723.    &sourceRect,
  724.    &destRect,
  725.    srcCopy,
  726.    nil);
  727.  
  728. You need to look at the c header files to know what
  729. they are looking for.  Rectangles can only be passed
  730. by address in C, for example.
  731.  
  732. Good Luck!
  733.  
  734. Greg Bolsinga
  735. Learn Television
  736.  
  737.  
  738. +++++++++++++++++++++++++++
  739.  
  740. >From ernie@winternet.com (Ernie Soffronoff)
  741. Date: 3 Mar 1995 18:54:33 GMT
  742. Organization: StarNet Communications, Inc
  743.  
  744. Oh, and I should say that the type mismatch appears in the first argument 
  745. to copybits.
  746.  
  747. --Ernie
  748.  
  749. +++++++++++++++++++++++++++
  750.  
  751. >From ssample1@cc.swarthmore.edu (Stephen &roo Sample)
  752. Date: 3 Mar 1995 21:14:47 GMT
  753. Organization: RadioVcular Stereo Systems
  754.  
  755. In article <3j7dra$44q@blackice.winternet.com>, ernie@winternet.com (Ernie
  756. Soffronoff) wrote:
  757.  
  758. >         CopyBits(*pmh, GrafPtr(curWindow)->portBits, sourceRect, 
  759. >                         destRect, srcCopy, nil);
  760.  
  761. CopyBits wants its first two arguments to look like pointers to bitmaps, so try
  762.  
  763.    CopyBits((BitMap *)*pmh, &curWindow->portBits,
  764.          sourceRect, destRect, srcCopy, nil)
  765.  
  766.    
  767. Ta,
  768.    -Stephen
  769.  
  770. +++++++++++++++++++++++++++
  771.  
  772. >From ssample1@cc.swarthmore.edu (Stephen &roo Sample)
  773. Date: 3 Mar 1995 21:18:55 GMT
  774. Organization: RadioVcular Stereo Systems
  775.  
  776. Oh, and I forgot, if the system has 32-bit QD 1.3 or later, you should use
  777.  
  778.          pmh = GetGWorldPixMap(myOffGWorld);
  779.  
  780. rather than
  781.  
  782. >         pmh = myOffGWorld->portPixMap;
  783.  
  784.  
  785. Ta,
  786.    -Stephen
  787.  
  788. +++++++++++++++++++++++++++
  789.  
  790. >From darth@zfn.uni-bremen.de (Jochen Lippert)
  791. Date: Sun, 05 Mar 1995 19:01:23 +0100
  792. Organization: University of Bremen
  793.  
  794. In article <3j7dra$44q@blackice.winternet.com>, ernie@winternet.com (Ernie
  795. Soffronoff) wrote:
  796.  
  797. > Howdy,
  798. > In an effort to be cool, I decided to try some off-screen graphics a la 
  799. > NIM: Imaging with Quickdraw.  The result: I'm not cool.  I get a type 
  800. > mismatch on the copybits line of the code below.  The rest of it seems 
  801. > okay, allocating memory and such and not crashing.  What the heck is 
  802. > copybits expecting?  (And why the heck is NIM in Pascal?)
  803. (some code deleted)
  804. >
  805. >         CopyBits(*pmh, GrafPtr(curWindow)->portBits, sourceRect, 
  806. >                         destRect, srcCopy, nil);
  807. I think the reason why your compiler complains is the second parameter of
  808. the CopyBits call. It should be: (GrafPtr)curWindow->portBits. The problem
  809. really seems to be that NIM's code examples are in Pascal, cause you used
  810. a Pascal style type conversion here (can be quite confusing reading Pascal
  811. and writing C).
  812.  
  813. Jochen Lippert
  814.  
  815. darth@zfn.uni-bremen.de
  816.  
  817. +++++++++++++++++++++++++++
  818.  
  819. >From darth@zfn.uni-bremen.de (Jochen Lippert)
  820. Date: Mon, 06 Mar 1995 12:47:51 +0100
  821. Organization: University of Bremen
  822.  
  823. In article <darth-0503951901230001@mac-lehre6.informatik.uni-bremen.de>,
  824. darth@zfn.uni-bremen.de (Jochen Lippert) wrote:
  825.  
  826. (The piece of C code that caused the trouble:)
  827.  
  828. >
  829. >         CopyBits(*pmh, GrafPtr(curWindow)->portBits, sourceRect, 
  830. >                         destRect, srcCopy, nil);
  831.  
  832. Oops! Greg Bolsinga discovered some more errors, and he is right: CopyBits
  833. wants the BitMaps and the Rects as pointers, so you must pass their
  834. addresses. Apart from that, it doesn't seem to be neccessary to convert
  835. the WindowPtr to a GrafPtr, although that may be good style... ;)
  836.  
  837. Jochen Lippert
  838.  
  839. darth@zfn.uni-bremen.de
  840.  
  841. +++++++++++++++++++++++++++
  842.  
  843. >From ernie@winternet.com (Ernie Soffronoff)
  844. Date: 7 Mar 1995 15:36:41 GMT
  845. Organization: StarNet Communications, Inc
  846.  
  847. Thanks to all who replied here and via mail!  I've got it working now. 
  848. Though I got mail about not posting this to csmp.codewarrior, posting it
  849. here got a lot more responses than csmp.help.  That doesn't make it right
  850. (since it certainly wasn't a CodeWarrior problem but a C/Toolbox problem),
  851. and I won't do it again, but I think it says a lot about CW users. 
  852.  
  853. Will NIM be changed into C?  For a somewhat new and incompletely trained 
  854. C programmer who still thinks in Pascal part of the time, I find it a 
  855. real drag.
  856.  
  857. --Ernie
  858. ernie@winternet.com
  859.  
  860. ---------------------------
  861.  
  862. >From kloss@bms.com (John Kloss)
  863. Subject: NEWBIE: Saving Popup Menu Selection
  864. Date: Thu, 09 Mar 1995 19:19:22 -0500
  865. Organization: Bristol-Myers Squibb
  866.  
  867. As a fledgling C programmer, I am at the point where I am just starting to
  868. be able to get myself into trouble, but lack the expertise to get myself
  869. back out again.  My situation is this.  I have created a (modal) dialog
  870. box which contains the usual assortment of nefarious suspects (popup menu,
  871. save/cancel buttons, editable text items, and static text items).
  872. Operationally, the popup menu is used to control which static and editable
  873. text items are visible.  I have been able to write the editable text items
  874. into a 'STR ' resource so that I can read them back when necessary.  My
  875. problem is that I am not quite sure how to save and restore the popup menu
  876. setting.  I assume that I can write the menu item to an 'STR ' resource
  877. and then, whenever I need to, I can retrieve the 'STR ' string, turn it
  878. back into a number, and then drop the number into an "Adjust_PopUp_Menu(
  879. )" routine.  Is there a better way?  I am not even sure that this approach
  880. will work, and am even less certain as to what would go into the
  881. "Adjust_PopUp_Menu( )" routine.
  882. As an addendum, I should add that I have not, as yet, learned "Files" so
  883. reading/writing into a prefs file it out (for now).  Anyway, the main
  884. problem of restoring a popup menu to a pre-existing setting would still
  885. remain.
  886. Any direction or source code tidbits would be greatly appreciated.
  887. Thanks,
  888. John
  889.  
  890. -- 
  891. John Kloss
  892. kloss@bms.com
  893. [phone] 609-252-5284  [fax] 609-252-6094
  894. - ------------------------------------------------------------------------
  895.  
  896. +++++++++++++++++++++++++++
  897.  
  898. >From kurisuto@babel.ling.upenn.edu (Sean Crist)
  899. Date: 10 Mar 1995 01:58:38 GMT
  900. Organization: University of Pennsylvania, Linguistics Department
  901.  
  902. In article <kloss-0903951919220001@shadowstone.bms.com>,
  903. John Kloss <kloss@bms.com> wrote:
  904. >As a fledgling C programmer, I am at the point where I am just starting to
  905. >be able to get myself into trouble, but lack the expertise to get myself
  906. >back out again.  My situation is this.  I have created a (modal) dialog
  907. >box which contains the usual assortment of nefarious suspects (popup menu,
  908. >save/cancel buttons, editable text items, and static text items).
  909. >Operationally, the popup menu is used to control which static and editable
  910. >text items are visible.  I have been able to write the editable text items
  911. >into a 'STR ' resource so that I can read them back when necessary.  My
  912. >problem is that I am not quite sure how to save and restore the popup menu
  913. >setting.  I assume that I can write the menu item to an 'STR ' resource
  914. >and then, whenever I need to, I can retrieve the 'STR ' string, turn it
  915. >back into a number, and then drop the number into an "Adjust_PopUp_Menu(
  916. >)" routine.  Is there a better way?  I am not even sure that this approach
  917. >will work, and am even less certain as to what would go into the
  918. >"Adjust_PopUp_Menu( )" routine.
  919.  
  920. Since you already know how to write into resources, why don't you just save
  921. the number for your popup menu item in its own little resource?  I don't
  922. know C, but here's how I'd do this in Pascal:
  923.  
  924. type
  925.   IntPtr = ^Integer;
  926.   IntHandle = ^IntPtr;  {to get around the type restrictions}
  927. var
  928.   OkSoFar : Boolean;    {If anything goes wrong, we set this to FALSE.}
  929.   MyIntHandle : IntHandle;  {Handle to the new resource.}
  930. begin
  931.   OkSoFar := TRUE;   {So far, we've encountered no errors.}
  932.  
  933. > MyIntHandle := IntHandle(NewHandle(SizeOf(Integer)));  {Create a handle.}
  934.   if MemErr <> 0 then    {Did it go okay?}
  935.     OkSoFar := FALSE;    {No, so fall through the rest of the routine.}
  936.  
  937.   if OkSoFar then    {No errors so far, so let's continue.}
  938.      begin
  939.        MyIntHandle^^ := MyPopupNumber;  {Store the value in the handle.}
  940. >      AddResource (Handle(MyIntHandle), 'Blah', 128, ''); 
  941.               {Add the handle as a resource.}
  942.               {Maybe these arguments aren't in the right order}
  943.               {'Blah' is the resource type; 128 is the rsrc number}
  944.        if ResErr <> 0 then   {Did everything go okay?}
  945.           OkSoFar := FALSE;  {No, so fail.}
  946.      end;
  947.  
  948. I've put a > by the really important lines; the rest is error checking
  949. stuff.  Then, when you start your program up again and want to read this
  950. back in, you would call GetResource.
  951.  
  952. >As an addendum, I should add that I have not, as yet, learned "Files" so
  953. >reading/writing into a prefs file it out (for now).  Anyway, the main
  954. >problem of restoring a popup menu to a pre-existing setting would still
  955. >remain.
  956.  
  957. My thinking on this general kind of issue is as follows.  Ultimately, your
  958. program is only concerned with two things: 1) how your program stores its
  959. data on the inside, and 2) how it represents those data to the user.
  960. Really, programming is almost completely the clerical task of mapping back
  961. and forth between those two representations.
  962.  
  963. If I were you, I wouldn't ask "How can I store and retrieve the setting for
  964. a popup menu?"  Then correct question, IMHO, is "How do I store and
  965. retrieve this underlying piece of data (which, as an irrelevant detail, I
  966. happen to represent with a popup menu)?"  There's really two steps: 1) how
  967. to store this value to disk, and retrieve it, and 2) how to map the value
  968. to a popup menu representation, and how to map user actions on that popup
  969. back into the value.
  970.  
  971.       Disk  <--------->   Variable    <----------->  User Interface Items
  972.  
  973. If you're using the Popup control items (which I guess most people do these
  974. days), it's a little misleading, since that control holds the number of the
  975. currently visible item.  It's up to you whether you want to use this as the
  976. place where you keep track of your data.  Personally, I keep all my data in
  977. underlying data structures which the user never sees; I never keep data
  978. only in controls.  The fact that some controls hold a value is to me a
  979. trivial detail in the process of representing the underlying data to the
  980. user.  But that's personal style.
  981.  
  982. I hope all this hasn't been too far out in left field.
  983.  
  984.   \/ __ __    _\_     --Sean Crist  (kurisuto@unagi.cis.upenn.edu)
  985.  ---  |  |    \ /     For a free copy of the Bill of Rights, finger
  986.   _| ,| ,|   -----       this account.
  987.   _| ,| ,|    [_]     Q: What do Standard Oil, AT&T, and Microsoft have in
  988.    |  |  |    [_]        common?   A:  Nothing... yet.
  989.  
  990. ---------------------------
  991.  
  992. >From snakai@us.oracle.com (Sergio Nakai)
  993. Subject: Recommend: A better List Mgr.
  994. Date: 7 Mar 1995 21:43:29 GMT
  995. Organization: Oracle Corporation. Redwood Shores, CA
  996.  
  997.  
  998. I'm looking for a better and more powerful table/list manager than
  999. the Mac Toolbox's List Manager.  I found adds for 2 products--
  1000. StoneTablet Publishing's Stone Table 2.0 and Graphical Business
  1001. Interfaces, Inc.'s TableIt!  Does anybody have any comments, praises,
  1002. concerns, etc. with either of these products or companies (quality of
  1003. products, ease of use, look and feel of tables, support, bug fixes, 
  1004. etc)?  Or, is there a better product available?  Any help and 
  1005. information will be greatly appreciated.  Please post replies to 
  1006. the c.s.m.p.help or tools newsgroups, or email directly to 
  1007. snakai@us.oracle.com.  Thanks.
  1008.  
  1009. Sergio Nakai
  1010.  
  1011.  
  1012.  
  1013. +++++++++++++++++++++++++++
  1014.  
  1015. >From mickm@netcom.com (Mickey Mestel)
  1016. Date: Thu, 9 Mar 1995 07:05:39 GMT
  1017. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1018.  
  1019. Sergio,
  1020.  
  1021. > I'm looking for a better and more powerful table/list manager than
  1022. > the Mac Toolbox's List Manager.  I found adds for 2 products--
  1023. > StoneTablet Publishing's Stone Table 2.0 and Graphical Business
  1024.  
  1025.         i have been developing a product that needed a much more robust tool
  1026. than the list manager, and bought stone table.  unfortunately, this is a biased
  1027. review as i have never played with tabelit!
  1028.  
  1029.         basically, stone table is great.  the first thing about it is that
  1030. it is plug in compatible with the list manager, i.e. all the list manager calls
  1031. are in stonetable, with a tmx_ instead of a l_ (or whatever it is), so l_new
  1032. is tmx_new.  that makes it intuitively easy as all you have to do is replace
  1033. the function names in an existing app and away you go, as the functions do 
  1034. the same thing, but are much more powerful.
  1035.  
  1036.         i don't need to go through the list of what you can do with his 
  1037. product, but i developed in weeks what would have taken me months at least
  1038. if i was using the regular list manager.  i found it all to be really easy
  1039. to use, sometimes my biggest problem was just not looking close enough at the
  1040. manual to see that he already has a function to do what i was looking at doing.
  1041.  
  1042.         one of the best things about it is that he is *very* responsive to
  1043. bug reports, of which there were mostly small ones.  most of the time he had
  1044. fixes within days.  i had a problem that my app was crashing, and he did
  1045. everything to help me, and eventually fixed the problem.  if half the software 
  1046. companies out there gave that kind of response...
  1047.  
  1048.         looking back over this, it sounds like a hell of a plug, but that is
  1049. because i'm really satisfied and impressed.
  1050.  
  1051.         the only limitations i can think of are small things, and will 
  1052. eventually be part of stone table if enough people ask for it.  no major
  1053. complaints at all.
  1054.  
  1055.  
  1056.         the look of the tables is *very* customizable, and i think very nice.
  1057. my partner thought they didn't look very mac like, but with just a few options
  1058. to the setup fuction that was taken care of.  you have a lot of freedom in
  1059. designing the looks of the tables, as well as multiple tables in windows, 
  1060. moving the tables themselves, drag and drop between tables and windows, etc.
  1061. great stuff.
  1062.         
  1063.         if you have any specific questions, feel free to e-mail me.  i'll be
  1064. out of town the 14th - 4th.
  1065.  
  1066.         mickm
  1067.  
  1068. -- 
  1069.  
  1070. _____________________________________________________________________________
  1071. Mickey Mestel                                                mickm@netcom.com
  1072. InfoService                                               infoserv@netcom.com
  1073. (415) 321-8024
  1074.  
  1075. file://ftp.netcom.com/pub/in/infoserv/inforservice.html
  1076. *we're here, excuse netcoms pathetically slow interface...
  1077.  
  1078. -on a beach in thailand to a beautiful, stoned, norwegian woman:
  1079.         "..yeah, it's just another foreign country without ice."
  1080. - ---------------------------------------------------------------------------
  1081.  
  1082. +++++++++++++++++++++++++++
  1083.  
  1084. >From kurisuto@babel.ling.upenn.edu (Sean Crist)
  1085. Date: 9 Mar 1995 15:53:33 GMT
  1086. Organization: University of Pennsylvania, Linguistics Department
  1087.  
  1088. In article <snakai-070395133332@snakai-mac.us.oracle.com>,
  1089. Sergio Nakai <snakai@us.oracle.com> wrote:
  1090. >
  1091. >I'm looking for a better and more powerful table/list manager than
  1092. >the Mac Toolbox's List Manager.  I found adds for 2 products--
  1093. >StoneTablet Publishing's Stone Table 2.0 and Graphical Business
  1094. >Interfaces, Inc.'s TableIt!  Does anybody have any comments, praises,
  1095. >concerns, etc. with either of these products or companies (quality of
  1096. >products, ease of use, look and feel of tables, support, bug fixes, 
  1097. >etc)?  Or, is there a better product available?  Any help and 
  1098. >information will be greatly appreciated.  Please post replies to 
  1099. >the c.s.m.p.help or tools newsgroups, or email directly to 
  1100. >snakai@us.oracle.com.  Thanks.
  1101.  
  1102. I can't attest to Stone Table's value, although those who use it seem to
  1103. like it.  The problem is you have to pay for it, which basically cuts me
  1104. out of the market right away since, as a starving student, I was doing good
  1105. to buy the Old IM series and a compiler to start with.  Fortunately, I've
  1106. found that it's easy to make some sturdy hacks to get the List Manager to
  1107. do what I want.
  1108.  
  1109. For example, when I wanted to be able to drag cells out of the window,
  1110. couldn't use LClick, since it doesn't have a hook for such a thing.  So
  1111. instead I just call the appropriate List Manager routines to figure out
  1112. which cell the mousedown fell in, then do the dragging, and then hilite the
  1113. appropriate cell with SetHilite (or whatever).  (I check to see if the
  1114. mousedown is in the scroll bar, and if so, I just call LClick and let
  1115. the List Manager do that itself).
  1116.  
  1117. This kind of thing really only takes a few extra lines of code, and if you
  1118. do it right it can be very sturdy.  As for myself, I'm satisfied with the
  1119. List Manager.  It can take a little ingenuity to get it to do unusual
  1120. things, but there's usually a good way to do it.  But if your time/money
  1121. ratio is better than mine, then of course it makes sense to buy something
  1122. that someone else has written and worked on until it's good and sturdy.
  1123.  
  1124.   \/ __ __    _\_     --Sean Crist  (kurisuto@unagi.cis.upenn.edu)
  1125.  ---  |  |    \ /     For a free copy of the Bill of Rights, finger
  1126.   _| ,| ,|   -----       this account.
  1127.   _| ,| ,|    [_]     Q: What do Standard Oil, AT&T, and Microsoft have in
  1128.    |  |  |    [_]        common?   A:  Nothing... yet.
  1129.  
  1130.  
  1131.  
  1132.  
  1133. +++++++++++++++++++++++++++
  1134.  
  1135. >From greg@math.harvard.edu (Gregory D. Landweber)
  1136. Date: Thu, 09 Mar 1995 13:55:17 -0500
  1137. Organization: Harvard University
  1138.  
  1139. In article <3jn89t$hrq@netnews.upenn.edu>, kurisuto@babel.ling.upenn.edu
  1140. (Sean Crist) wrote:
  1141.  
  1142. > For example, when I wanted to be able to drag cells out of the window,
  1143. > couldn't use LClick, since it doesn't have a hook for such a thing.
  1144.  
  1145. Yes it does.  Just install a "lClikLoop" routine that handles drags out
  1146. of the window.  That's what I do in Greg's Browser.
  1147.  
  1148. -- Greg Landweber
  1149.    greg@math.harvard.edu
  1150. (author of "Greg's Buttons" and "Greg's Browser")
  1151.  
  1152. +++++++++++++++++++++++++++
  1153.  
  1154. >From kurisuto@babel.ling.upenn.edu (Sean Crist)
  1155. Date: 9 Mar 1995 19:47:43 GMT
  1156. Organization: University of Pennsylvania, Linguistics Department
  1157.  
  1158. In article <greg-0903951355170001@glandweb.student.harvard.edu>,
  1159. Gregory D. Landweber <greg@math.harvard.edu> wrote:
  1160. >In article <3jn89t$hrq@netnews.upenn.edu>, kurisuto@babel.ling.upenn.edu
  1161. >(Sean Crist) wrote:
  1162. >
  1163. >> For example, when I wanted to be able to drag cells out of the window,
  1164. >> couldn't use LClick, since it doesn't have a hook for such a thing.
  1165. >
  1166. >Yes it does.  Just install a "lClikLoop" routine that handles drags out
  1167. >of the window.  That's what I do in Greg's Browser.
  1168.  
  1169. Hmpf.  You're right.  But doesn't LClick still do automatic scrolling once
  1170. the mouse is outside the list?  I wouldn't want that, but maybe the
  1171. presence of an lClikLoop tells LClick not to do automatic scrolling.  Is
  1172. that the case?
  1173.  
  1174.   \/ __ __    _\_     --Sean Crist  (kurisuto@unagi.cis.upenn.edu)
  1175.  ---  |  |    \ /     For a free copy of the Bill of Rights, finger
  1176.   _| ,| ,|   -----       this account.
  1177.   _| ,| ,|    [_]     Q: What do Standard Oil, AT&T, and Microsoft have in
  1178.    |  |  |    [_]        common?   A:  Nothing... yet.
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185. +++++++++++++++++++++++++++
  1186.  
  1187. >From rvtaylor@netcom.com (Richard Taylor)
  1188. Date: Thu, 9 Mar 1995 21:02:56 GMT
  1189. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1190.  
  1191. Sergio Nakai (snakai@us.oracle.com) wrote:
  1192.  
  1193. : I'm looking for a better and more powerful table/list manager than
  1194. : the Mac Toolbox's List Manager.  I found adds for 2 products--
  1195. : StoneTablet Publishing's Stone Table 2.0 and Graphical Business
  1196. : Interfaces, Inc.'s TableIt!  Does anybody have any comments, praises,
  1197. : concerns, etc. with either of these products or companies (quality of
  1198.  
  1199. I have written many messages here praising StoneTable.  We use it in 
  1200. several ways in our commercial app and we are =very= happy with it.  From 
  1201. simple lists that are >32k to multiple tables in a dlog where the user 
  1202. drags cells from one table to fill in another.  We also use it as a 
  1203. spreadsheet and take advantage of the full font/color control even in 
  1204. System 6.0.x.   I could go on and on; the support has been stupendous.
  1205.  
  1206. Richard Taylor
  1207.  
  1208. -- 
  1209. richard taylor:     rvtaylor@netcom.com
  1210.  
  1211.  
  1212. +++++++++++++++++++++++++++
  1213.  
  1214. >From greg@math.harvard.edu (Gregory D. Landweber)
  1215. Date: Thu, 09 Mar 1995 16:14:48 -0500
  1216. Organization: Harvard University
  1217.  
  1218. In article <3jnm0v$6v0@netnews.upenn.edu>, kurisuto@babel.ling.upenn.edu
  1219. (Sean Crist) wrote:
  1220.  
  1221. > In article <greg-0903951355170001@glandweb.student.harvard.edu>,
  1222. > Gregory D. Landweber <greg@math.harvard.edu> wrote:
  1223. > >In article <3jn89t$hrq@netnews.upenn.edu>, kurisuto@babel.ling.upenn.edu
  1224. > >(Sean Crist) wrote:
  1225. > >
  1226. > >> For example, when I wanted to be able to drag cells out of the window,
  1227. > >> couldn't use LClick, since it doesn't have a hook for such a thing.
  1228. > >
  1229. > >Yes it does.  Just install a "lClikLoop" routine that handles drags out
  1230. > >of the window.  That's what I do in Greg's Browser.
  1231. > Hmpf.  You're right.  But doesn't LClick still do automatic scrolling once
  1232. > the mouse is outside the list?  I wouldn't want that, but maybe the
  1233. > presence of an lClikLoop tells LClick not to do automatic scrolling.  Is
  1234. > that the case?
  1235.  
  1236. If the user has initiated a drag, then my lClikLoop routine retains control
  1237. until the user releases the mouse button.  So, when the user drags outside
  1238. the list, my lClikLoop routine is in control, and I don't have to worry
  1239. about LClick's automatic scrolling.
  1240.  
  1241. -- Greg Landweber
  1242.    greg@math.harvard.edu
  1243. (author of "Greg's Buttons" and "Greg's Browser")
  1244.  
  1245. ---------------------------
  1246.  
  1247. >From picco@netcom.com (Marty Picco)
  1248. Subject: Resources and header files
  1249. Date: Mon, 6 Mar 1995 17:07:27 GMT
  1250. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1251.  
  1252. I am a beginning mac programmer learning the toolbox et al.  I have no 
  1253. problem setting up menus, etc. with ResEdit.  Is there some tool that I can
  1254. use to convert resource IDs into symbolic names (or is there some naming
  1255. convention)?  For example, when processing the result of a MenuSelect() call,
  1256. I'd prefer to use something like 'mQuit' rather than '0x800003' to refer to 
  1257. my 'quit' menu item.  It seems that coding the #defines by hand would be ugly,
  1258. since there's plenty of opportunity to screw up if I use ResEdit to move
  1259. things around.
  1260.  
  1261. By the way, I am using CodeWarrior DR5; so far I haven't ventured into
  1262. PowerPlant.  I also don't have any apple tools except ResEdit.
  1263.  
  1264. Any help would be appreciated.
  1265.  
  1266.  
  1267.  
  1268.  
  1269. +++++++++++++++++++++++++++
  1270.  
  1271. >From Daniel Seltzer <dseltzer@arcus.nyc.ny.us>
  1272. Date: 8 Mar 1995 00:33:39 GMT
  1273. Organization: Arcus Incorporated
  1274.  
  1275. This is really the eternal question regarding resources as I understand
  1276. it. How to bind them to your code without the overhead of massive string
  1277. comparisons, etc. Some systems, like Visual C++ on the Windows side,
  1278. generate code for you based on the resources as you edit them. That's got
  1279. its upside, but you're dependent on specific tools and ways of working
  1280. (the MS way). Unfortunately, I still tend to rely on a large number of
  1281. constants that are defined such as:
  1282.  
  1283. const ResIDT Wind_MyWindow  128
  1284.  
  1285. I've always wished that at the least a resource editor would generate a
  1286. header file for you based on a simple template. I figure that either the
  1287. guys who make Resorcerer are working on it or it's already there and I
  1288. never stumbled on it.
  1289.  
  1290. __________________________________
  1291. Daniel Seltzer
  1292. Arcus Incorporated
  1293. dseltzer@arcus.nyc.ny.us
  1294.  
  1295. +++++++++++++++++++++++++++
  1296.  
  1297. >From Daniel Seltzer <dseltzer@arcus.nyc.ny.us>
  1298. Date: 8 Mar 1995 02:19:28 GMT
  1299. Organization: Arcus Incorporated
  1300.  
  1301. In article <3jiu13$5u8@news.pipeline.com> Daniel Seltzer,
  1302. dseltzer@arcus.nyc.ny.us writes:
  1303. >const ResIDT Wind_MyWindow  128
  1304.  
  1305. Woops. That should have read:
  1306.  
  1307. const ResIDT Wind_MyWindow = 128;
  1308.  
  1309. Too many client meetings, not enough programming: the effects are
  1310. obvious, and quite fatal.
  1311.  
  1312. __________________________________
  1313. Daniel Seltzer
  1314. Arcus Incorporated
  1315. dseltzer@arcus.nyc.ny.us
  1316.  
  1317. +++++++++++++++++++++++++++
  1318.  
  1319. >From trygve@netcom.com (Trygve Isaacson)
  1320. Date: Thu, 9 Mar 1995 03:32:10 GMT
  1321. Organization: Freak Accident Music
  1322.  
  1323. In article <3jiu13$5u8@news.pipeline.com>, Daniel Seltzer
  1324. <dseltzer@arcus.nyc.ny.us> wrote:
  1325.  
  1326. > This is really the eternal question regarding resources as I understand
  1327. > it. How to bind them to your code without the overhead of massive string
  1328. > comparisons, etc. Some systems, like Visual C++ on the Windows side,
  1329. > generate code for you based on the resources as you edit them. That's got
  1330. > its upside, but you're dependent on specific tools and ways of working
  1331. > (the MS way). Unfortunately, I still tend to rely on a large number of
  1332. > constants that are defined such as:
  1333. > const ResIDT Wind_MyWindow  128
  1334.  
  1335. This may not get at what you're hoping for, but for what it's worth, here
  1336. are a couple things to remember in case you aren't taking advantage of
  1337. them:
  1338.  
  1339. You can use #define's for your resource IDs and put the #define's in a .h
  1340. header which is included from both your .r and .c/.h/.cp files. This lets
  1341. you keep each resource ID defined in a single place.
  1342.  
  1343. You can use #ifdef REZ and/or #ifndef REZ in your .h file to make both Rez
  1344. and C/C++ happy with the same file. For example, here's a .h file that can
  1345. be included by both compilers:
  1346.  
  1347. #define kDocumentWindowResourceID  128
  1348.  
  1349. #ifndef REZ
  1350.  
  1351. class TGeek: public TSlacker .... etc.
  1352.  
  1353. #endif /* REZ */
  1354.  
  1355. #ifdef REZ
  1356.  
  1357. type 'GEEK'
  1358.    {
  1359.    longint    ...etc.
  1360.    };
  1361.  
  1362. #endif /* REZ */
  1363.  
  1364. That kind of thing....
  1365. - -------------------------------------------------------------------
  1366. Trygve Isaacson                                     trygve@netcom.com
  1367.  
  1368. "The sea is warship grey / it whispers "fool", then slides away" -XTC
  1369. - -------------------------------------------------------------------
  1370.  
  1371. +++++++++++++++++++++++++++
  1372.  
  1373. >From 3gl21@qlink.queensu.ca (Gregory Lo)
  1374. Date: Thu, 09 Mar 1995 20:41:23 -0500
  1375. Organization: Queen's University
  1376.  
  1377. If you use Rez to compile your resources from Rez source code, then
  1378. in your Rez files you can #include header files that use the same C
  1379. preprocessor #defines and stuff.
  1380.  
  1381. For instance, you can define the following in a file resources.h :
  1382.    #define rMyWindowAlertID 128
  1383.    #define rMenuBar 128
  1384.    #define rErrorStringsList 12545
  1385. and then #include them wherever you need in your C/C++ source code, and
  1386. also in your Rez source code.
  1387. When you define a resource in Rez, you must supply it's resource ID, so
  1388. just use the macro from the header file that you included.
  1389. You can also incorporate the resource fork of any file that has a resource
  1390. fork by using the command:
  1391.    INCLUDE 'xxx.rsrc';
  1392. where xxx.rsrc is the name of the file you want to extract the resources
  1393. from.  This is great if you want to edit the resources in ResEdit, or
  1394. what-have-you, but again, you're on your own if you want to synchronize
  1395. the resource IDs in the resource fork with the IDs used in the rest of you
  1396. r program.
  1397.  
  1398. - ---------------------------------------------------------
  1399. Gregory Lo  GLo ?:^(>      <mailto:3gl21@qlink.queensu.ca>
  1400. <mailto:log@declab.queensu.ca>      <mailto:greglo@io.org>
  1401.  
  1402. ---------------------------
  1403.  
  1404. >From bmbode@iastate.edu (Brett M Bode)
  1405. Subject: Temporary Memory question...
  1406. Date: 20 Feb 1995 15:27:29 GMT
  1407. Organization: Iowa State University, Ames, IA (USA)
  1408.  
  1409. Hello,
  1410.    I am working on porting a large (4+Mb of source) application to the 
  1411. PowerMac.  In this application a pool of memory is requested at run time
  1412. based on an amount read in from an input file.  Because of the way the 
  1413. "dynamic" memory is addressed throughout the rest of the program (it is
  1414. obtained only once at start up) the memory must be locked such that a pointer
  1415. is used to address it.  This is of course fine if you use Malloc (or NewPtr)
  1416. to grab a portion of memory from the application partition, however, because
  1417. the amount of memory required will vary greatly from run to run this will
  1418. require the user to change the application partition size frequently.
  1419.    Thus it would seem to be better to use temporary memory for the "dynamic"
  1420. pool.  I know that the NIM Memory states that you should never leave a block
  1421. of temporary memory locked across calls to waitnextevent. Therefor my question
  1422. is: What are the ramifications of leaving temporary memory locked? What sort
  1423. of problems might occur?
  1424.  
  1425. Thanks for your time...
  1426.  
  1427. Brett Bode
  1428. bmbode@iastate.edu
  1429.  
  1430. -- 
  1431. _______________________________________________________________________
  1432.  
  1433. Brett M Bode
  1434. 201 Spedding Hall
  1435. Iowa State University
  1436. Ames, IA 50011
  1437. Phone: (515) 294-4604
  1438. bmbode@iastate.edu
  1439. _______________________________________________________________________
  1440.  
  1441. +++++++++++++++++++++++++++
  1442.  
  1443. >From sardaukar@aol.com (Sardaukar)
  1444. Date: 20 Feb 1995 21:34:23 -0500
  1445. Organization: America Online, Inc. (1-800-827-6364)
  1446.  
  1447. > What are the ramifications of leaving temporary memory locked? What sort
  1448. > of problems might occur?
  1449.  
  1450. Basically you remove the possibility of another program using temporary
  1451. memory.  If you swap to another process, the locked temp memory may
  1452. fragment the avaialable temp mem such that the next process can't do what
  1453. it needs to do.  You really shouldn't be using temp mem for so long that a
  1454. process switch is likely to occur.  Once you use it, you want to let it go
  1455. as fast as you can.  The RAM available to apps will be "shared" like this
  1456. much more in the Copland system; maybe even in the Marconi upgrade. Re
  1457. QuickDraw GX.
  1458.  
  1459. +++++++++++++++++++++++++++
  1460.  
  1461. >From sburrow@alchemy.chem.utoronto.ca (Tim Burrow)
  1462. Date: Tue, 21 Feb 1995 22:40:08 GMT
  1463. Organization: University of Toronto
  1464.  
  1465. In article <3ibjff$ros@newsbf02.news.aol.com>, sardaukar@aol.com
  1466. (Sardaukar) wrote:
  1467. >In article <3iacd1$as7@news.iastate.edu>, bmbode@iastate.edu (Brett M
  1468. Bode) wrote:
  1469. >> What are the ramifications of leaving temporary memory locked? What sort
  1470. >> of problems might occur?
  1471. >
  1472. >Basically you remove the possibility of another program using temporary
  1473. >memory.  If you swap to another process, the locked temp memory may
  1474. >fragment the avaialable temp mem such that the next process can't do what
  1475. >it needs to do.  You really shouldn't be using temp mem for so long that a
  1476. >process switch is likely to occur.  Once you use it, you want to let it go
  1477. >as fast as you can.  The RAM available to apps will be "shared" like this
  1478. >much more in the Copland system; maybe even in the Marconi upgrade. Re
  1479. >QuickDraw GX.
  1480.  
  1481. I thought it was ok to use temp memory across process switches, as long as
  1482. it was not locked and belonged to a document such that closing windows
  1483. freed the memory. Thus you don't have to allocate as much memory to your
  1484. application partition as you will ever need, just a minimum amount. 
  1485.  
  1486. Having temp memory locked when you call WaitNextEvent is a no-no.
  1487.  
  1488. -- 
  1489. Tim Burrow
  1490. sburrow@alchemy.chem.utoronto.ca
  1491.  
  1492. +++++++++++++++++++++++++++
  1493.  
  1494. >From gspnx@di.unito.it (Fabrizio Oddone)
  1495. Date: Wed, 22 Feb 1995 11:00:23 +0100
  1496. Organization: Politecnico di Torino - Italy
  1497.  
  1498. In article <3iacd1$as7@news.iastate.edu>, bmbode@iastate.edu (Brett M
  1499. Bode) wrote:
  1500.  
  1501. [snip]
  1502. >    Thus it would seem to be better to use temporary memory for the "dynamic"
  1503. > pool.  I know that the NIM Memory states that you should never leave a block
  1504. > of temporary memory locked across calls to waitnextevent. Therefor my question
  1505. > is: What are the ramifications of leaving temporary memory locked? What sort
  1506. > of problems might occur?
  1507.  
  1508. I recall that you should not leave temporary memory ALLOCATED across calls
  1509. to WaitNextEvent under SYSTEM 6.
  1510. System 7 has not this requirement (you may check its availability with a
  1511. Gestalt attribute - cannot recall the exact name, ends with ...isTracked).
  1512. You can HLock the handle, but if you are reading a file into this handle,
  1513. you actually need to keep the handle locked during PBReadAsync. When
  1514. reading ends, call HUnlock.
  1515.  
  1516. -- 
  1517.  Fabrizio Oddone
  1518. gspnx@di.unito.it
  1519.  
  1520. +++++++++++++++++++++++++++
  1521.  
  1522. >From pottier@bireme.ens.fr (Francois Pottier)
  1523. Date: 22 Feb 1995 13:36:15 GMT
  1524. Organization: Ecole Normale Superieure, PARIS, France
  1525.  
  1526. In article <sburrow-2102951740080001@slip2.chem.utoronto.ca>,
  1527. Tim Burrow <sburrow@alchemy.chem.utoronto.ca> wrote:
  1528.  
  1529. >Having temp memory locked when you call WaitNextEvent is a no-no.
  1530.  
  1531. I don't think it is. First, it works just fine. Second, I prefer
  1532. my app to have a 384k partition and a locked 100k temporary handle,
  1533. rather than a 1024k partition "just in case".
  1534.  
  1535. -- 
  1536. Francois Pottier                                            pottier@dmi.ens.fr
  1537. - ----------------------------------------------------------------------------
  1538. Check my WWW page at http://acacia.ens.fr:8080/home/pottier/index.html ...
  1539.  
  1540. +++++++++++++++++++++++++++
  1541.  
  1542. >From bmbode@iastate.edu (Brett M Bode)
  1543. Date: 22 Feb 1995 17:59:24 GMT
  1544. Organization: Iowa State University, Ames, IA (USA)
  1545.  
  1546. >In article <sburrow-2102951740080001@slip2.chem.utoronto.ca>,
  1547. >Tim Burrow <sburrow@alchemy.chem.utoronto.ca> wrote:
  1548. >
  1549. >>Having temp memory locked when you call WaitNextEvent is a no-no.
  1550. >
  1551. >I don't think it is. First, it works just fine. Second, I prefer
  1552. >my app to have a 384k partition and a locked 100k temporary handle,
  1553. >rather than a 1024k partition "just in case".
  1554. >
  1555. >--
  1556. >Francois Pottier                                            pottier@dmi.ens.fr
  1557. >------------------------------------------------------------------------------
  1558. >Check my WWW page at http://acacia.ens.fr:8080/home/pottier/index.html ...
  1559.  
  1560. I have to agree with Francios. Since no one provided me with a compelling
  1561. reason (like it WILL cause crashes etc) not to try it, I went ahead and
  1562. did it and thus far I have not had a problem.  I do not think I would do
  1563. it in all cercumstances, but for my problem it seems to be fine.  For those
  1564. who didn't catch my original post what I wanted to do was grab a large
  1565. chunk of temporary memory once at launch and then lock it in place
  1566. for the duration of the run (at which point the application will terminate).
  1567. So instead of having a large application partition (which I would have to 
  1568. resize depending on the particular run) I can just set the application partition
  1569. to the size needed for code and Global data and then get only as much extra
  1570. "dynamic" memory as is needed for the current run.  Just for your information
  1571. the size needed for the code and global data is about 3Mb and the dynamic
  1572. pool (depending on the run type) ranges from 1Mb to as much as you can give it
  1573. (meaning it can use 100+ Mb or more easily).
  1574.  
  1575. Thus I believe that doing this is not causing a problem with memory
  1576. fragmentation since I am only getting one block of memory once.  It is
  1577. probably not a good idea to repeatedly get small blocks and keep them locked,
  1578. since this would certainly lead to memory fragmentation. Also note that I 
  1579. said I was doing this on PowerMacs only, thus I am using System 7.1.2 or later
  1580. so I can count on Temporary Memory being real and tracked.
  1581.  
  1582. Brett Bode
  1583.  
  1584. -- 
  1585. _______________________________________________________________________
  1586.  
  1587. Brett M Bode
  1588. 201 Spedding Hall
  1589. Iowa State University
  1590. Ames, IA 50011
  1591. Phone: (515) 294-4604
  1592. bmbode@iastate.edu
  1593. _______________________________________________________________________
  1594.  
  1595. +++++++++++++++++++++++++++
  1596.  
  1597. >From isis@netcom.com (Mike Cohen)
  1598. Date: Wed, 22 Feb 1995 19:55:09 GMT
  1599. Organization: ISIS International
  1600.  
  1601. sburrow@alchemy.chem.utoronto.ca (Tim Burrow) writes:
  1602.  
  1603. >I thought it was ok to use temp memory across process switches, as long as
  1604. >it was not locked and belonged to a document such that closing windows
  1605. >freed the memory. Thus you don't have to allocate as much memory to your
  1606. >application partition as you will ever need, just a minimum amount. 
  1607.  
  1608. My strategy when I allocate huge blocks of memory is to try first in my own
  1609. heap, and then use temp memory if that fails.
  1610.  
  1611. -- 
  1612. Mike Cohen - isis@netcom.com
  1613. NewtonMail, eWorld: MikeC / ALink: D6734 / AOL: MikeC20
  1614. Home Page: ftp://ftp.netcom.com/pub/is/isis/home.html
  1615. PUSH THE BUTTON, FRANK... OR SOMEONE?
  1616.  
  1617. +++++++++++++++++++++++++++
  1618.  
  1619. >From THUNDERONE@news.delphi.com (THUNDERONE@DELPHI.COM)
  1620. Date: 22 Feb 1995 22:50:55 -0500
  1621. Organization: Delphi Internet Services Corporation
  1622.  
  1623. bmbode@iastate.edu (Brett M Bode) writes:
  1624.  
  1625. >>In article <sburrow-2102951740080001@slip2.chem.utoronto.ca>,
  1626. >>Tim Burrow <sburrow@alchemy.chem.utoronto.ca> wrote:
  1627. >>
  1628. >>>Having temp memory locked when you call WaitNextEvent is a no-no.
  1629. >>
  1630. >>I don't think it is. First, it works just fine. Second, I prefer
  1631. >>my app to have a 384k partition and a locked 100k temporary handle,
  1632. >>rather than a 1024k partition "just in case".
  1633. >>
  1634. >>--
  1635. >>Francois Pottier                                            pottier@dmi.ens.fr
  1636. >>------------------------------------------------------------------------------
  1637. >>Check my WWW page at http://acacia.ens.fr:8080/home/pottier/index.html ...
  1638.  
  1639. >I have to agree with Francios. Since no one provided me with a compelling
  1640. >reason (like it WILL cause crashes etc) not to try it, I went ahead and
  1641. >did it and thus far I have not had a problem.  I do not think I would do
  1642. >it in all cercumstances, but for my problem it seems to be fine.  For those
  1643. >who didn't catch my original post what I wanted to do was grab a large
  1644. >chunk of temporary memory once at launch and then lock it in place
  1645. >for the duration of the run (at which point the application will terminate).
  1646. >So instead of having a large application partition (which I would have to 
  1647. >resize depending on the particular run) I can just set the application partition
  1648. >to the size needed for code and Global data and then get only as much extra
  1649. >"dynamic" memory as is needed for the current run.  Just for your information
  1650. >the size needed for the code and global data is about 3Mb and the dynamic
  1651. >pool (depending on the run type) ranges from 1Mb to as much as you can give it
  1652. >(meaning it can use 100+ Mb or more easily).
  1653.  
  1654. >Thus I believe that doing this is not causing a problem with memory
  1655. >fragmentation since I am only getting one block of memory once.  It is
  1656. >probably not a good idea to repeatedly get small blocks and keep them locked,
  1657. >since this would certainly lead to memory fragmentation. Also note that I 
  1658. >said I was doing this on PowerMacs only, thus I am using System 7.1.2 or later
  1659. >so I can count on Temporary Memory being real and tracked.
  1660.  
  1661. I have to disagree.
  1662.  
  1663. 1.  You're ignoring one of the most important Mac Tech Notes in 
  1664. existence: Toolbox Karma.  Apple tells you not to leave handles locked 
  1665. across calls to WNE- this means, in part, that Apple reserves the right 
  1666. to break your code in the future.  Apple could easily make a change 
  1667. which would break your code, and would do so without reservation, 
  1668. knowing that all good developers follow the guidelines presented in 
  1669. Inside Macintosh, and you are a good developer, right?
  1670.  
  1671. 2.  IM does not tell you where the temporary memory is coming from.  
  1672. So your app is 3 megabytes.  Say that you're running on a 40-meg 
  1673. PowerMac.  The user has been up all night doing things with other 
  1674. programs, many of which are still in memory.  The user launches your 
  1675. program, which fits neatly into a space just above PageMaker and just 
  1676. below Photoshop.  What he doesn't know is that you've allocated 
  1677. another 2 megabytes of temporary memory.  The system had to grab this 
  1678. memory from a place higher up in memory, (your app is surrounded on 
  1679. either side by PS and PM, remember).  Your app locks it merrily, 
  1680. happily going about it's business.  The user quits two applications 
  1681. which happen to be on either side of the space in which your 2 meg 
  1682. tempmem block exists, with the intent of running some application with 
  1683. even larger RAM requirements than yours.  When he does this, the 
  1684. system informs him that there's not enough *contiguous* free space, even 
  1685. though there *is* enough *total* free space.  Do you see the point I'm 
  1686. trying to make?
  1687.  
  1688. 3.  System 7 is a reasonable minimum assumption for 68k Macs as well.
  1689.  
  1690. ________________.______.._____...___....._.....................
  1691. Chris Thomas, thunderone@delphi.com, code elf
  1692.  
  1693.  
  1694. +++++++++++++++++++++++++++
  1695.  
  1696. >From devans@apple.com (Dave Evans)
  1697. Date: 23 Feb 1995 10:00:28 GMT
  1698. Organization: Apple Computer, Inc.
  1699.  
  1700. bmbode@iastate.edu (Brett M Bode) wrote:
  1701. >...I know that the NIM Memory states that you should never leave a block
  1702. > of temporary memory locked across calls to waitnextevent. Therefor my question
  1703. > is: What are the ramifications of leaving temporary memory locked? What sort
  1704. > of problems might occur?
  1705.  
  1706. Locking temporary memory across a waitnextevent call is impolite.
  1707. Doing so may prevent memory from moving for a new application to launch. 
  1708. This will cause user confusion ("but I do have that much RAM free...
  1709. why can't I launch this other application?") when your locked temporary
  1710. memory fragments the process manager's heap.  Such a fragmentation may
  1711. prevent a new application from launching if a large enough contiguous
  1712. block of this memory cannot be had.
  1713.  
  1714. But you can certainly do this technically.  Locking the memory across
  1715. waitnextevent should behave safely without side effects.
  1716.  
  1717. dave
  1718.  
  1719. - -
  1720. Apple Computer, Inc. pays the bills but doesn't endorse what I might
  1721. say (especially after midnight...)
  1722.  
  1723. +++++++++++++++++++++++++++
  1724.  
  1725. >From pottier@corvette.ens.fr (Francois Pottier)
  1726. Date: 23 Feb 1995 16:11:18 GMT
  1727. Organization: Ecole Normale Superieure, PARIS, France
  1728.  
  1729. In article <3ih0mv$2b3@news2.delphi.com>,
  1730. THUNDERONE@DELPHI.COM <THUNDERONE@news.delphi.com> wrote:
  1731.  
  1732. >existence: Toolbox Karma.  Apple tells you not to leave handles locked 
  1733. >across calls to WNE- this means, in part, that Apple reserves the right 
  1734. >to break your code in the future.
  1735.  
  1736. The whole partition concept is brain-dead and is a leftover from the 
  1737. old days. I'm ready to bet that it is going to disappear at some point
  1738. when the new systems arrive.
  1739.  
  1740. >even larger RAM requirements than yours.  When he does this, the 
  1741. >system informs him that there's not enough *contiguous* free space, even 
  1742. >though there *is* enough *total* free space.  Do you see the point I'm 
  1743. >trying to make?
  1744.  
  1745. Sure. But say my app needs anywhere between 1 and 10 megs, depending on
  1746. what phase of its job it's currently doing. There are two methods, using
  1747. a big partition and using temp mem. If I ask for a 10 meg partition,
  1748. I won't create fragmentation but half of the time I'll be wasting 5 megs.
  1749. If I use temporary memory, I might add one block to the heap but the free
  1750. memory figure is much higher. I still think using temp mem is better.
  1751.  
  1752. What we really need is a good implementation where all apps draw their storage
  1753. from a common pool and the MMU is used to hide fragmentation, IMHO.
  1754.  
  1755.  
  1756.  
  1757.  
  1758. -- 
  1759. Francois Pottier                                            pottier@dmi.ens.fr
  1760. - ----------------------------------------------------------------------------
  1761. Check my WWW page at http://acacia.ens.fr:8080/home/pottier/index.html ...
  1762.  
  1763. +++++++++++++++++++++++++++
  1764.  
  1765. >From kenp@nmrfam.wisc.edu (Ken Prehoda)
  1766. Date: Thu, 23 Feb 1995 11:19:56 -0600
  1767. Organization: Univ of Wisc-Madison, Dept of Biochemistry
  1768.  
  1769. In article <3iic36$ov2@nef.ens.fr>, pottier@corvette.ens.fr (Francois
  1770. Pottier) wrote:
  1771.  
  1772. : In article <3ih0mv$2b3@news2.delphi.com>,
  1773. : THUNDERONE@DELPHI.COM <THUNDERONE@news.delphi.com> wrote:
  1774. : >existence: Toolbox Karma.  Apple tells you not to leave handles locked 
  1775. : >across calls to WNE- this means, in part, that Apple reserves the right 
  1776. : >to break your code in the future.
  1777. : The whole partition concept is brain-dead and is a leftover from the 
  1778. : old days. I'm ready to bet that it is going to disappear at some point
  1779. : when the new systems arrive.
  1780. : >even larger RAM requirements than yours.  When he does this, the 
  1781. : >system informs him that there's not enough *contiguous* free space, even 
  1782. : >though there *is* enough *total* free space.  Do you see the point I'm 
  1783. : >trying to make?
  1784. : Sure. But say my app needs anywhere between 1 and 10 megs, depending on
  1785. : what phase of its job it's currently doing. There are two methods, using
  1786. : a big partition and using temp mem. If I ask for a 10 meg partition,
  1787. : I won't create fragmentation but half of the time I'll be wasting 5 megs.
  1788. : If I use temporary memory, I might add one block to the heap but the free
  1789. : memory figure is much higher. I still think using temp mem is better.
  1790. : What we really need is a good implementation where all apps draw their storage
  1791. : from a common pool and the MMU is used to hide fragmentation, IMHO.
  1792.  
  1793. And doesn't RamDoubler do a good job at this anyway?
  1794.  
  1795. -- 
  1796. Ken Prehoda, kenp@nmrfam.wisc.edu
  1797.  
  1798. +++++++++++++++++++++++++++
  1799.  
  1800. >From english@primenet.com (Lawson English)
  1801. Date: 23 Feb 1995 19:07:52 GMT
  1802. Organization: Primenet
  1803.  
  1804. Dave Evans (devans@apple.com) wrote:
  1805. : bmbode@iastate.edu (Brett M Bode) wrote:
  1806. : >...I know that the NIM Memory states that you should never leave a block
  1807. : > of temporary memory locked across calls to waitnextevent. Therefor my question
  1808. : > is: What are the ramifications of leaving temporary memory locked? What sort
  1809. : > of problems might occur?
  1810.  
  1811. : Locking temporary memory across a waitnextevent call is impolite.
  1812. : Doing so may prevent memory from moving for a new application to launch. 
  1813. : This will cause user confusion ("but I do have that much RAM free...
  1814. : why can't I launch this other application?") when your locked temporary
  1815. : memory fragments the process manager's heap.  Such a fragmentation may
  1816. : prevent a new application from launching if a large enough contiguous
  1817. : block of this memory cannot be had.
  1818.  
  1819. : But you can certainly do this technically.  Locking the memory across
  1820. : waitnextevent should behave safely without side effects.
  1821.  
  1822. New IM: Memory even says this. "In certain circumstances, however, you 
  1823. can hold temporary memory indefinitely. For example, if the temporary 
  1824. memory is used for open files, and the user can free that memory simply 
  1825. by clsing those files, it is safe to hold onto that memory as long as 
  1826. necessary." (NIM:Memory, p 2-10).
  1827.  
  1828. Since NIM:Memory provides the gestalt selectors to determine if System 7 
  1829. is being used and that the behavior for the Memory Manager is as is 
  1830. described in the book, unless there is a tech note published after the 
  1831. book was released, I don't see why anyone is arguing in the first place.
  1832.  
  1833. In otherwords, New Inside Macintosh supercedes any previously published 
  1834. tech notes, and the information should apply (barring non-documented 
  1835. bugs) until a new version of the book, or a new tech note is published, 
  1836. as long as you are running System 7 and are checking the gestalt selector 
  1837. for the proper behavior documented in the book... And NIM:Memory says 
  1838. that you can hold temporary memory as long as you like, as long as you 
  1839. follow the guidelines in the book.
  1840.  
  1841. : dave
  1842.  
  1843. : ---
  1844. : Apple Computer, Inc. pays the bills but doesn't endorse what I might
  1845. : say (especially after midnight...)
  1846.  
  1847. --
  1848. - -----------------------------------------------------------------------------
  1849. Lawson English                            __  __     ____  ___       ___ ____
  1850. english@primenet.com                     /__)/__) / / / / /_  /\  / /_    /
  1851.                                         /   / \  / / / / /__ /  \/ /___  /
  1852. - -----------------------------------------------------------------------------
  1853.  
  1854. +++++++++++++++++++++++++++
  1855.  
  1856. >From THUNDERONE@news.delphi.com (THUNDERONE@DELPHI.COM)
  1857. Date: 23 Feb 1995 22:47:49 -0500
  1858. Organization: Delphi Internet Services Corporation
  1859.  
  1860. kenp@nmrfam.wisc.edu (Ken Prehoda) writes:
  1861.  
  1862. >In article <3iic36$ov2@nef.ens.fr>, pottier@corvette.ens.fr (Francois
  1863. >Pottier) wrote:
  1864. >: 
  1865. >: What we really need is a good implementation where all apps draw their storage
  1866. >: from a common pool and the MMU is used to hide fragmentation, IMHO.
  1867.  
  1868. >And doesn't RamDoubler do a good job at this anyway?
  1869.  
  1870. No.  RamDoubler just compresses RAM.  You're thinking of OptiMem 
  1871. (aka OptimMem RamCharger).  Both of these can be used together if you 
  1872. have the latest versions, which is rather cool, except that PowerMac 
  1873. CodeWarrior users probably don't want to deal with the headaches.
  1874.  
  1875. It's not the same as having it integrated into the system as a 
  1876. documented facility.  The problem is that many apps don't just allocate 
  1877. when they need it- they implement their own memory managers, taking 
  1878. their entire heap as a single block.  This is one thing Apple might be 
  1879. having a hard time with in Copland.
  1880.  
  1881. OptiMem seems to be the best that can be done using today's apps, 
  1882. though.  Don't think it uses the MMU.
  1883.  
  1884. ________________.______.._____...___....._.....................
  1885. Chris Thomas, thunderone@delphi.com, call me lightning
  1886.  
  1887. +++++++++++++++++++++++++++
  1888.  
  1889. >From THUNDERONE@news.delphi.com (THUNDERONE@DELPHI.COM)
  1890. Date: 23 Feb 1995 22:51:38 -0500
  1891. Organization: Delphi Internet Services Corporation
  1892.  
  1893. pottier@corvette.ens.fr (Francois Pottier) writes:
  1894.  
  1895. >In article <3ih0mv$2b3@news2.delphi.com>,
  1896. >THUNDERONE@DELPHI.COM <THUNDERONE@news.delphi.com> wrote:
  1897.  
  1898. >>existence: Toolbox Karma.  Apple tells you not to leave handles locked 
  1899. >>across calls to WNE- this means, in part, that Apple reserves the right 
  1900. >>to break your code in the future.
  1901.  
  1902. >The whole partition concept is brain-dead and is a leftover from the 
  1903. >old days. I'm ready to bet that it is going to disappear at some point
  1904. >when the new systems arrive.
  1905.  
  1906. I agree, but what I said still applies.
  1907.  
  1908. >>even larger RAM requirements than yours.  When he does this, the 
  1909. >>system informs him that there's not enough *contiguous* free space, even 
  1910. >>though there *is* enough *total* free space.  Do you see the point I'm 
  1911. >>trying to make?
  1912.  
  1913. >Sure. But say my app needs anywhere between 1 and 10 megs, depending on
  1914. >what phase of its job it's currently doing. There are two methods, using
  1915. >a big partition and using temp mem. If I ask for a 10 meg partition,
  1916. >I won't create fragmentation but half of the time I'll be wasting 5 megs.
  1917. >If I use temporary memory, I might add one block to the heap but the free
  1918. >memory figure is much higher. I still think using temp mem is better.
  1919.  
  1920. No, you missed the point, (but I didn't state it very clearly): the 
  1921. average *end user*, Joe Hasntgotaclue, is not going to realize what the 
  1922. problem is.  He might assume that his Mac is broken, or he might come 
  1923. away thinking that MacOS sucks.  At least when you're wasting 5 
  1924. megabytes, the user can find a cause for out-of-memory - your app is 
  1925. wasting 10 megabytes!
  1926.  
  1927. >What we really need is a good implementation where all apps draw their storage
  1928. >from a common pool and the MMU is used to hide fragmentation, IMHO.
  1929.  
  1930. True.
  1931.  
  1932. ________________.______.._____...___....._.....................
  1933. Chris Thomas, thunderone@delphi.com, the frequency
  1934.  
  1935. +++++++++++++++++++++++++++
  1936.  
  1937. >From THUNDERONE@news.delphi.com (THUNDERONE@DELPHI.COM)
  1938. Date: 23 Feb 1995 22:56:10 -0500
  1939. Organization: Delphi Internet Services Corporation
  1940.  
  1941. english@primenet.com (Lawson English) writes:
  1942.  
  1943. >Dave Evans (devans@apple.com) wrote:
  1944.  
  1945. >: Locking temporary memory across a waitnextevent call is impolite.
  1946. >: Doing so may prevent memory from moving for a new application to launch. 
  1947. >: This will cause user confusion ("but I do have that much RAM free...
  1948. >: why can't I launch this other application?") when your locked temporary
  1949. >: memory fragments the process manager's heap.  Such a fragmentation may
  1950. >: prevent a new application from launching if a large enough contiguous
  1951. >: block of this memory cannot be had.
  1952.  
  1953. >: But you can certainly do this technically.  Locking the memory across
  1954. >: waitnextevent should behave safely without side effects.
  1955.  
  1956. >New IM: Memory even says this. "In certain circumstances, however, you 
  1957. >can hold temporary memory indefinitely. For example, if the temporary 
  1958. >memory is used for open files, and the user can free that memory simply 
  1959. >by clsing those files, it is safe to hold onto that memory as long as 
  1960. >necessary." (NIM:Memory, p 2-10).
  1961.  
  1962. What NIM is saying is that you're allowed to keep temporary memory 
  1963. through calls to WaitNextEvent.  What we're discussing is locking that 
  1964. memory across calls to WaitNextEvent, which is documented as a Bad 
  1965. Thing.
  1966.  
  1967. ________________.______.._____...___....._.....................
  1968. Chris Thomas, thunderone@delphi.com, really just out of habit
  1969.  
  1970.  
  1971. +++++++++++++++++++++++++++
  1972.  
  1973. >From kenp@nmrfam.wisc.edu (Ken Prehoda)
  1974. Date: Fri, 24 Feb 1995 09:27:58 -0600
  1975. Organization: Univ of Wisc-Madison, Dept of Biochemistry
  1976.  
  1977. In article <3ijkt5$12l@news2.delphi.com>, THUNDERONE@news.delphi.com
  1978. (THUNDERONE@DELPHI.COM) wrote:
  1979.  
  1980. : kenp@nmrfam.wisc.edu (Ken Prehoda) writes:
  1981. : >In article <3iic36$ov2@nef.ens.fr>, pottier@corvette.ens.fr (Francois
  1982. : >Pottier) wrote:
  1983. : >: 
  1984. : >: What we really need is a good implementation where all apps draw
  1985. their storage
  1986. : >: from a common pool and the MMU is used to hide fragmentation, IMHO.
  1987. : >And doesn't RamDoubler do a good job at this anyway?
  1988. : No.  RamDoubler just compresses RAM.  You're thinking of OptiMem 
  1989.  
  1990. That's not true from what I've read.  RamDoubler does not compress RAM. 
  1991. What it does do is use the unused memory in an apps partition to give to
  1992. other apps (using the MMU?).  Once this memory is used up, RamDoubler
  1993. resorts to paging.
  1994.  
  1995. However, I have not looked into it in detail.  Do you have some other
  1996. information?
  1997.  
  1998. -- 
  1999. Ken Prehoda, kenp@nmrfam.wisc.edu
  2000.  
  2001. +++++++++++++++++++++++++++
  2002.  
  2003. >From english@primenet.com (Lawson English)
  2004. Date: 24 Feb 1995 22:45:03 GMT
  2005. Organization: Primenet
  2006.  
  2007. Ken Prehoda (kenp@nmrfam.wisc.edu) wrote:
  2008.  
  2009. : That's not true from what I've read.  RamDoubler does not compress RAM. 
  2010. : What it does do is use the unused memory in an apps partition to give to
  2011. : other apps (using the MMU?).  Once this memory is used up, RamDoubler
  2012. : resorts to paging.
  2013.  
  2014. : However, I have not looked into it in detail.  Do you have some other
  2015. : information?
  2016.  
  2017. As I recall, RamDoubler does three things:
  2018.  
  2019. First, it pools all the unused RAM in every app's partition to free up 
  2020. RAM for all partitions. When it runs low, it starts compressing RAM, 
  2021. presumably using an efficient algorithm (patented, I believe). When all else 
  2022. fails, it starts paging to disk.
  2023.  
  2024.  
  2025. : -- 
  2026. : Ken Prehoda, kenp@nmrfam.wisc.edu
  2027.  
  2028. --
  2029. - -----------------------------------------------------------------------------
  2030. Lawson English                            __  __     ____  ___       ___ ____
  2031. english@primenet.com                     /__)/__) / / / / /_  /\  / /_    /
  2032.                                         /   / \  / / / / /__ /  \/ /___  /
  2033. - -----------------------------------------------------------------------------
  2034.  
  2035. +++++++++++++++++++++++++++
  2036.  
  2037. >From isis@netcom.com (Mike Cohen)
  2038. Date: Sun, 26 Feb 1995 20:27:25 GMT
  2039. Organization: ISIS International
  2040.  
  2041. pottier@bireme.ens.fr (Francois Pottier) writes:
  2042.  
  2043. >In article <sburrow-2102951740080001@slip2.chem.utoronto.ca>,
  2044. >Tim Burrow <sburrow@alchemy.chem.utoronto.ca> wrote:
  2045.  
  2046. >>Having temp memory locked when you call WaitNextEvent is a no-no.
  2047.  
  2048. >I don't think it is. First, it works just fine. Second, I prefer
  2049. >my app to have a 384k partition and a locked 100k temporary handle,
  2050. >rather than a 1024k partition "just in case".
  2051.  
  2052. In one case I allocate a huge (4M or so) handle to use to generate an entire
  2053. 300dpi page image for printing. I first try to allocate it in my own heap, and
  2054. if that fails I go to temporary memory. This seems to be a pretty good strategy
  2055. that I've done in several cases where I need a large block of memory for one
  2056. specific operation.
  2057.  
  2058. -- 
  2059. Mike Cohen - isis@netcom.com
  2060. NewtonMail, eWorld: MikeC / ALink: D6734 / AOL: MikeC20
  2061. Home Page: ftp://ftp.netcom.com/pub/is/isis/home.html
  2062. PUSH THE BUTTON, FRANK... OR SOMEONE?
  2063.  
  2064. +++++++++++++++++++++++++++
  2065.  
  2066. >From rollin@newton.apple.com (Keith Rollin)
  2067. Date: Sun, 26 Feb 1995 15:48:31 -0800
  2068. Organization: Apple ][ -> Mac -> Taligent -> Newton -> Windows?
  2069.  
  2070. In article <3ifekf$44u@nef.ens.fr>, pottier@bireme.ens.fr (Francois
  2071. Pottier) wrote:
  2072.  
  2073. >In article <sburrow-2102951740080001@slip2.chem.utoronto.ca>,
  2074. >Tim Burrow <sburrow@alchemy.chem.utoronto.ca> wrote:
  2075. >
  2076. >>Having temp memory locked when you call WaitNextEvent is a no-no.
  2077. >
  2078. >I don't think it is. First, it works just fine. Second, I prefer
  2079. >my app to have a 384k partition and a locked 100k temporary handle,
  2080. >rather than a 1024k partition "just in case".
  2081.  
  2082. Unless you're doing something like allocating WindowRecords from this 100K
  2083. temporary memory handle, I can't think of any reason for you to keep that
  2084. handle locked across calls that could perform a context switch. Be a good
  2085. citizen and keep that handle unlocked.
  2086.  
  2087. - --------------------------------------------------------------------------
  2088. Keith Rollin --- Phantom Programmer --- Apple Computer, Inc. --- Team Newton
  2089. "I say, let's write "wacko" on all the rocks and be done with it."
  2090.  
  2091. +++++++++++++++++++++++++++
  2092.  
  2093. >From pottier@felouque.ens.fr (Francois Pottier)
  2094. Date: 27 Feb 1995 20:07:02 GMT
  2095. Organization: Ecole Normale Superieure, PARIS, France
  2096.  
  2097. In article <rollin-2602951548310001@mac70.kip.apple.com>,
  2098. Keith Rollin <rollin@newton.apple.com> wrote:
  2099.  
  2100. >Unless you're doing something like allocating WindowRecords from this 100K
  2101. >temporary memory handle, I can't think of any reason for you to keep that
  2102. >handle locked across calls that could perform a context switch. Be a good
  2103. >citizen and keep that handle unlocked.
  2104.  
  2105. I can't - my handle is actually chock full of C++ pointer-based objects.
  2106. The idea is that usually I will allocate them from my own heap, but if the
  2107. user is very active and creates lots of windows, then I'll overflow into
  2108. the temporary heap. It shouldn't last very long.
  2109.  
  2110. Crashing is bad and gracefully exiting when new() returns nil is difficult.
  2111. This is a sad world :-/
  2112.  
  2113.  
  2114. -- 
  2115. Francois Pottier                                            pottier@dmi.ens.fr
  2116. - ----------------------------------------------------------------------------
  2117. Check my WWW page at http://acacia.ens.fr:8080/home/pottier/index.html ...
  2118.  
  2119. +++++++++++++++++++++++++++
  2120.  
  2121. >From stk@berlin.snafu.de (Stefan Kurth)
  2122. Date: Tue, 28 Feb 1995 00:29:51 +0100
  2123. Organization: none
  2124.  
  2125. Keith Rollin <rollin@newton.apple.com> wrote:
  2126.  
  2127. > Unless you're doing something like allocating WindowRecords from this 100K
  2128. > temporary memory handle, I can't think of any reason for you to keep that
  2129. > handle locked across calls that could perform a context switch. Be a good
  2130. > citizen and keep that handle unlocked.
  2131.  
  2132. One such reason is when you want to read or write the handle's contents
  2133. to/from disk asynchronously, and (trying to be a good citizen) call
  2134. WaitNextEvent every couple of ticks meanwhile.
  2135.  
  2136. Now which is better, locking the handle for this relatively short period
  2137. of time, or doing the IO synchronously?  I'm asking seriously, I really
  2138. don't know.
  2139.  
  2140. ________________________________________________________________________
  2141. Stefan Kurth               Berlin, Germany           stk@berlin.snafu.de
  2142.  
  2143. +++++++++++++++++++++++++++
  2144.  
  2145. >From gspnx@di.unito.it (Fabrizio Oddone)
  2146. Date: Thu, 02 Mar 1995 19:56:32 +0100
  2147. Organization: Politecnico di Torino - Italy
  2148.  
  2149. In article <3itnak$nte@unlisys.unlisys.NET>, stk@berlin.snafu.de (Stefan
  2150. Kurth) wrote:
  2151.  
  2152. > Keith Rollin <rollin@newton.apple.com> wrote:
  2153. > > Unless you're doing something like allocating WindowRecords from this 100K
  2154. > > temporary memory handle, I can't think of any reason for you to keep that
  2155. > > handle locked across calls that could perform a context switch. Be a good
  2156. > > citizen and keep that handle unlocked.
  2157. > One such reason is when you want to read or write the handle's contents
  2158. > to/from disk asynchronously, and (trying to be a good citizen) call
  2159. > WaitNextEvent every couple of ticks meanwhile.
  2160. > Now which is better, locking the handle for this relatively short period
  2161. > of time, or doing the IO synchronously?  I'm asking seriously, I really
  2162. > don't know.
  2163.  
  2164. If the read/write is not very time-consuming, I usually PBxxxAsync(), do
  2165. anything I can do in the meantime, then poll ioResult in a while {} loop
  2166. calling SystemTask() and EventAvail(), so I don't have to handle events
  2167. immediately; events are left in the queue and extracted later in my main
  2168. event loop.
  2169.  
  2170. I think async calls are generally a Good Thing, although sync calls are
  2171. easier to implement.
  2172.  
  2173. -- 
  2174.  Fabrizio Oddone
  2175. gspnx@di.unito.it
  2176.  
  2177. +++++++++++++++++++++++++++
  2178.  
  2179. >From stk@berlin.snafu.de (Stefan Kurth)
  2180. Date: Fri, 03 Mar 1995 18:15:00 +0100
  2181. Organization: none
  2182.  
  2183. Fabrizio Oddone <gspnx@di.unito.it> wrote:
  2184.  
  2185. > > One such reason is when you want to read or write the handle's contents
  2186. > > to/from disk asynchronously, and (trying to be a good citizen) call
  2187. > > WaitNextEvent every couple of ticks meanwhile.
  2188. > >
  2189. > > Now which is better, locking the handle for this relatively short period
  2190. > > of time, or doing the IO synchronously?  I'm asking seriously, I really
  2191. > > don't know.
  2192. >
  2193. > If the read/write is not very time-consuming, I usually PBxxxAsync(), do
  2194. > anything I can do in the meantime, then poll ioResult in a while {} loop
  2195. > calling SystemTask() and EventAvail(), so I don't have to handle events
  2196. > immediately; events are left in the queue and extracted later in my main
  2197. > event loop.
  2198.  
  2199. This doesn't answer the question.  If you call SystemTask and EventAvail
  2200. while waiting for your async call to complete, you have to lock the
  2201. handle, since these calls can move memory.
  2202.  
  2203. Anyone else?  Is it ok to lock a temp handle during an async read/write
  2204. call in order to be able to give time to other processes, or is it
  2205. better to do it synchronously instead?
  2206.  
  2207. ________________________________________________________________________
  2208. Stefan Kurth               Berlin, Germany           stk@berlin.snafu.de
  2209.  
  2210. +++++++++++++++++++++++++++
  2211.  
  2212. >From tulip@tiac.net (Ed Anson)
  2213. Date: Fri, 03 Mar 1995 15:36:53 -0500
  2214. Organization: Tulip Software
  2215.  
  2216. In article <3j7ire$knv@unlisys.unlisys.NET>, stk@berlin.snafu.de (Stefan
  2217. Kurth) wrote:
  2218.  
  2219. > This doesn't answer the question.  If you call SystemTask and EventAvail
  2220. > while waiting for your async call to complete, you have to lock the
  2221. > handle, since these calls can move memory.
  2222. > Anyone else?  Is it ok to lock a temp handle during an async read/write
  2223. > call in order to be able to give time to other processes, or is it
  2224. > better to do it synchronously instead?
  2225.  
  2226. Locking a handle in temp memory will usually be ok. However, there are
  2227. some risks associated with it.
  2228.  
  2229. A lot depends on where the handle lies in the temp memory. It could
  2230. fragment the memory, thus preventing an application from launching. If it
  2231. is at the low end of temp memory, it could interfere with loading
  2232. components (e.g., QuickTime, AppleScript, etc.).
  2233.  
  2234. Apart from these risks, I see nothing wrong with it. And if you expect the
  2235. asynchronous I/O to complete very quickly, the risk is small and it might
  2236. be worth the risk if you get a substantial performance improvement. You
  2237. have to evaluate that.
  2238.  
  2239. - --------------------
  2240. Ed Anson            MediaTree: multimedia outline editor & catalog
  2241. Tulip Software
  2242. Andover, MA 01810   For details, check out my WWW page:
  2243. U.S.A.              <http://www.tiac.net/users/tulip/home.html>
  2244.  
  2245. +++++++++++++++++++++++++++
  2246.  
  2247. >From gspnx@di.unito.it (Fabrizio Oddone)
  2248. Date: Tue, 07 Mar 1995 15:20:11 +0100
  2249. Organization: Politecnico di Torino - Italy
  2250.  
  2251. In article <3j7ire$knv@unlisys.unlisys.NET>, stk@berlin.snafu.de (Stefan
  2252. Kurth) wrote:
  2253.  
  2254. > Fabrizio Oddone <gspnx@di.unito.it> wrote:
  2255. > > If the read/write is not very time-consuming, I usually PBxxxAsync(), do
  2256. > > anything I can do in the meantime, then poll ioResult in a while {} loop
  2257. > > calling SystemTask() and EventAvail(), so I don't have to handle events
  2258. > > immediately; events are left in the queue and extracted later in my main
  2259. > > event loop.
  2260. > This doesn't answer the question.  If you call SystemTask and EventAvail
  2261. > while waiting for your async call to complete, you have to lock the
  2262. > handle, since these calls can move memory.
  2263.  
  2264. Yes, you MUST obviously lock the handle.
  2265.  
  2266. The external fragmentation problem is a Mac OS problem, is not a Mac
  2267. developer problem (IMHO).
  2268. As soon as we see the new OS with separate address spaces, that won't be a
  2269. problem any more.
  2270.  
  2271. -- 
  2272.  Fabrizio Oddone
  2273. gspnx@di.unito.it
  2274.  
  2275. ---------------------------
  2276.  
  2277. >From gregb@apple.com (Greg Branche)
  2278. Subject: The State of MPW
  2279. Date: Mon, 06 Mar 1995 14:12:02 -0800
  2280. Organization: Apple Computer, Inc.
  2281.  
  2282. Gary asked me to post this a while ago, and I apologize for taking so long
  2283. to get it out.  It's been buried in my queue for at least 3 or 4 weeks,
  2284. and it's taken me this long to clear my interrupt stack to get to it.
  2285.  
  2286. The original thread appeared in comp.sys.mac.programmer.codewarrior, but I
  2287. felt that this reply didn't really belong there, since it primarily
  2288. concerns MPW.
  2289.  
  2290. Here goes:
  2291.  
  2292. ======================================================================
  2293.  
  2294. In a recent message in comp.sys.mac.programmer.codewarrior, Amanda Walker
  2295. of InterCon Systems Corporation said:
  2296.  
  2297.  >According to the people at Apple I've spoken to, MPW will cease to exist after
  2298.  >ETO 18, and even now only has one person working part time on it, doing only
  2299.  >emergency bug fixes.
  2300.   
  2301.  >We've gotten official reponses from MacDTS that the Projector bugs we
  2302.  >reported last year will never be fixed, and that Apple has committed to
  2303.  >Symantec C++ as their future baseline development environment.
  2304.   
  2305. As the MPW product manager, allow me to set the record straight   MPW
  2306. lives on! We9ve still have plenty of engineers on the MPW team and we9re
  2307. currently looking
  2308. for more. Have a look at the last couple of MPW/E.T.O. releases to see
  2309. what they9ve been up to   native MPW tools; faster compilers; new tools to
  2310. support the CFM-68K runtime; improvements to MacApp; new debuggers; and so
  2311. on.
  2312.  
  2313. There may be some confusion because we are currently transitioning from
  2314. the MPW 68K C and C++ compilers to MPW-hosted C and C++ compilers that
  2315. Symantec is creating for us pursuant to a development contract. Our plan
  2316. is to roll these into 3Latest MPW2 around the E.T.O. #18 time frame, thus
  2317. obsoleting MPW C and MPW C++ (CFront). We9re doing this because it was
  2318. much easier to adapt Symantec9s compilers for use with CFM-68K (and,
  2319. therefore, OpenDoc); they provide faster turnaround times; and they
  2320. generate comparable code.
  2321.  
  2322. On the Power Macintosh side, we9re transitioning from PPCC to MrC,
  2323. primarily because of the much faster compile times provided by the MrC
  2324. front end (provided  by Symantec). (MrC and PPCC share the same back-end,
  2325. so code quality is the same.) The MrC compiler operates up to four times
  2326. faster than the native version of PPCC.
  2327.  
  2328. MPW users have told us for some time that we must improve turnaround time,
  2329. so that9s what we9ve been focusing on for some time now.
  2330.  
  2331. As for bug fixes, we continue to evaluate, prioritize, and fix bugs for
  2332. MPW. I9m not sure which bugs Amanda was told would 3never be fixed2;
  2333. perhaps she could tell me directly so we can learn why that response may
  2334. have been communicated. Quite often the bug list contains many enhancement
  2335. requests which may receive a low priority or be rejected for a variety of
  2336. reasons.
  2337.  
  2338. By the way, E.T.O. #16 and MPW Pro #16 just shipped. There are dozens of
  2339. enhancements, include a beta of MrC/MrCpp, a faster PPCLink, Native PPCAsm
  2340. 1.1, MPW p2c (an Object Pascal to C/C++ source code converter), and the
  2341. CFM-68K and SOM runtimes (and related tools).
  2342.  
  2343.  Gary Little
  2344.  MPW Product Manager
  2345. ======================================================================
  2346.  
  2347. Greg Branche
  2348. MPW Entomologist
  2349. Apple Computer, Inc.
  2350.  
  2351. ---------------------------
  2352.  
  2353. >From daniel@nbre.nfe.be (Daniel Van Den Broeck)
  2354. Subject: [Q] FSSpec --> dirID
  2355. Date: 16 Feb 95 09:40:51 CET
  2356. Organization: NightBreed
  2357.  
  2358.  
  2359. How can I get the dirID of a directory from wich i've got the FSSpec's ?
  2360. The FSSpec only contain the *parent* directory ID as I remember well.
  2361.  
  2362. Daniel Van Den Broeck
  2363. daniel@nbre.nfe.be
  2364. 2:292/603.81
  2365.  
  2366. +++++++++++++++++++++++++++
  2367.  
  2368. >From hawkfish@halcyon.com (Richard Wesley)
  2369. Date: 20 Feb 1995 05:29:21 GMT
  2370. Organization: Punch Deck Consulting
  2371.  
  2372. In article <ce230000@nbre.nfe.be>
  2373. daniel@nbre.nfe.be (Daniel Van Den Broeck) writes:
  2374.  
  2375. > How can I get the dirID of a directory from wich i've got the FSSpec's ?
  2376. > The FSSpec only contain the *parent* directory ID as I remember well.
  2377. > Daniel Van Den Broeck
  2378. > daniel@nbre.nfe.be
  2379. > 2:292/603.81
  2380.  
  2381. Use PBGetCatInfo.  
  2382.  
  2383. - rmgw
  2384.  
  2385. - ------------------------------------------------------------------------------
  2386.  
  2387. Richard Wesley     hawkfish@halcyon.com | "If we're not careful, we could have
  2388. Punch Deck Consulting  pnchdeck@aol.com |  a farce on our hands!"
  2389.      Macintosh Software Development     |    - Tom Stoppard, "On the Razzle"
  2390. - ------------------------------------------------------------------------------
  2391.  
  2392.  
  2393. +++++++++++++++++++++++++++
  2394.  
  2395. >From David.Walton.10@nd.edu (David Walton)
  2396. Date: Thu, 02 Mar 1995 18:15:38 -0500
  2397. Organization: University of Notre Dame, OUC
  2398.  
  2399. In article <3i99bh$2q4@news.halcyon.com>, hawkfish@halcyon.com (Richard
  2400. Wesley) wrote:
  2401.  
  2402. > In article <ce230000@nbre.nfe.be>
  2403. > daniel@nbre.nfe.be (Daniel Van Den Broeck) writes:
  2404. > > 
  2405. > > How can I get the dirID of a directory from wich i've got the FSSpec's ?
  2406. > > The FSSpec only contain the *parent* directory ID as I remember well.
  2407. > > 
  2408. > > Daniel Van Den Broeck
  2409. > > daniel@nbre.nfe.be
  2410. > > 2:292/603.81
  2411. > Use PBGetCatInfo.  
  2412.  
  2413. I just fill in the vRefNum and parID field, concatenate a fake file name
  2414. to the end of the directory name, and call FSMakeFSSpec().  Since
  2415. FSMakeFSSpec() will create a valid spec even for a non-existent file, you
  2416. can use that fact to get a valid dirID.  E.g.:
  2417.  
  2418. vRefNum:          -1
  2419. parID:            4315
  2420. fName (dirName):  "Untitled folder"
  2421.  
  2422. so:
  2423.  
  2424. error = FSMakeFSSpec(-1, 4315, "\pUntitled folder:fakeFile", &mySpec);
  2425. myDirID = spec.parID;/* dirID of "Untitled folder" */
  2426.  
  2427. David
  2428.  
  2429. -- 
  2430. David Walton
  2431. Office of University Computing/Dept. History & Philosophy of Science
  2432. University of Notre Dame
  2433. Mail:  David.Walton.10@nd.edu           http://www.nd.edu/~dwalton1/  
  2434.  
  2435.            "You're mighty brave in cyberspace, flame-boy."
  2436.  
  2437. +++++++++++++++++++++++++++
  2438.  
  2439. >From peter@mail.peter.com.au (Peter Lewis)
  2440. Date: Sat, 04 Mar 1995 09:34:39 +0800
  2441. Organization: iiNET Technologies
  2442.  
  2443. In article <David.Walton.10-0203951815380001@erasmus.cc.nd.edu>,
  2444. David.Walton.10@nd.edu (David Walton) wrote:
  2445.  
  2446. >I just fill in the vRefNum and parID field, concatenate a fake file name
  2447. >to the end of the directory name, and call FSMakeFSSpec().  Since
  2448. >FSMakeFSSpec() will create a valid spec even for a non-existent file, you
  2449. >can use that fact to get a valid dirID.  E.g.:
  2450. >
  2451. >vRefNum:          -1
  2452. >parID:            4315
  2453. >fName (dirName):  "Untitled folder"
  2454.  
  2455. That will work
  2456.  
  2457. >error = FSMakeFSSpec(-1, 4315, "\pUntitled folder:fakeFile", &mySpec);
  2458. >myDirID = spec.parID;/* dirID of "Untitled folder" */
  2459.  
  2460. Untitled folder:fakeFile is a full path name, so I expect it will ignore
  2461. the 4315 dirID and return an invalid FSSpec.  I use FSpGetCatInfo - which
  2462. of course isn't implemented by the OS, but it is a very useful routine to
  2463. have in your collection:
  2464.  
  2465.    function FSpGetCatInfo (var fs: FSSpec; index: integer; var pb:
  2466. CInfoPBRec): OSErr;
  2467.    begin
  2468.       pb.ioVRefNum := fs.vRefNum;
  2469.       pb.ioDirID := fs.parID;
  2470.       pb.ioNamePtr := @fs.name;
  2471.       pb.ioFDirIndex := index;
  2472.       FSpGetCatInfo := PBGetCatInfoSync(@pb);
  2473.    end;
  2474.  
  2475. or it's companion HGetCatInfo:
  2476.  
  2477.    function HGetCatInfo (vrn: integer; dirID: longInt; var name: string;
  2478. index: integer; var pb: CInfoPBRec): OSErr;
  2479.    begin
  2480.       pb.ioVRefNum := vrn;
  2481.       pb.ioDirID := dirID;
  2482.       pb.ioNamePtr := @name;
  2483.       pb.ioFDirIndex := index;
  2484.       HGetCatInfo := PBGetCatInfoSync(@pb);
  2485.    end;
  2486.  
  2487. So you would do:
  2488.  
  2489. err := HGetCatInfo(-1,4315,"Untitled folder",-1,pb);
  2490. dirID:=pb.ioDirID;
  2491.  
  2492. or
  2493. err := FSpGetCatInfo(fs,-1,pb);
  2494. fs.parID:=pb.ioDirID;
  2495. fs.name:='';
  2496.  
  2497. Enjoy,
  2498.    Peter.
  2499. -- 
  2500. The probability of me making it to the WWDC in 1995 is currently: 95%
  2501.  
  2502. +++++++++++++++++++++++++++
  2503.  
  2504. >From kevin@vailbox.washington.dc.us (Kevin Michael Vail)
  2505. Date: Sun, 05 Mar 1995 22:09:48 -0500
  2506. Organization: Vailhalla
  2507.  
  2508. In article <peter-0403950934390001@zany.peter.com.au>,
  2509. peter@mail.peter.com.au (Peter Lewis) wrote:
  2510.  
  2511. :In article <David.Walton.10-0203951815380001@erasmus.cc.nd.edu>,
  2512. :David.Walton.10@nd.edu (David Walton) wrote:
  2513. :
  2514. :>I just fill in the vRefNum and parID field, concatenate a fake file name
  2515. :>to the end of the directory name, and call FSMakeFSSpec().  Since
  2516. :>FSMakeFSSpec() will create a valid spec even for a non-existent file, you
  2517. :>can use that fact to get a valid dirID.  E.g.:
  2518. :>
  2519. :>vRefNum:          -1
  2520. :>parID:            4315
  2521. :>fName (dirName):  "Untitled folder"
  2522. :
  2523. :That will work
  2524. :
  2525. :>error = FSMakeFSSpec(-1, 4315, "\pUntitled folder:fakeFile", &mySpec);
  2526. :>myDirID = spec.parID;/* dirID of "Untitled folder" */
  2527. :
  2528. :Untitled folder:fakeFile is a full path name, so I expect it will ignore
  2529. :the 4315 dirID and return an invalid FSSpec.
  2530.  
  2531. True, but if you put a colon in front of it as well ("\p:Untitled
  2532. folder:fakeFile"), it will work.
  2533.  
  2534. And probably everybody in the world knew this but me, but I just found out
  2535. that if you have an FSSpec to a file and you want one for the parent of
  2536. that file, you can use (assume fileSpec is the FSSpec of the file you
  2537. have, and you want the parent spec in parentSpec):
  2538.  
  2539.    FSMakeFSSpec(fileSpec.vRefNum, fileSpec.parID, "\p:", &parentSpec);
  2540.  
  2541. Kevin
  2542. -- 
  2543. Kevin Michael Vail              |  As a general rule, don't solve puzzles
  2544. kevin@vailbox.washington.dc.us  |  that open portals to Hell.
  2545.                                 |   -- A Horror Movie Character's Survival Guide
  2546.  
  2547. ---------------------------
  2548.  
  2549. End of C.S.M.P. Digest
  2550. **********************
  2551.